Log autofill query and response to assist testing.


BUG=177760


Review URL: https://chromiumcodereview.appspot.com/12328059

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@185706 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/autofill/autocheckout/whitelist_manager.cc b/chrome/browser/autofill/autocheckout/whitelist_manager.cc
index 71d69ee..bf1196aa 100644
--- a/chrome/browser/autofill/autocheckout/whitelist_manager.cc
+++ b/chrome/browser/autofill/autocheckout/whitelist_manager.cc
@@ -124,8 +124,10 @@
     // This is only for ~20 sites initially, liner search is sufficient.
     // TODO(benquan): Look for optimization options when we support
     // more sites.
-    if (StartsWithASCII(url.spec(), *it, true))
+    if (StartsWithASCII(url.spec(), *it, true)) {
+      DVLOG(1) << "WhitelistManager matched URLPrefix: " << *it;
       return *it;
+    }
   }
   return std::string();
 }
diff --git a/chrome/browser/autofill/autofill_download.cc b/chrome/browser/autofill/autofill_download.cc
index 94bc8ba0..ebb0074 100644
--- a/chrome/browser/autofill/autofill_download.cc
+++ b/chrome/browser/autofill/autofill_download.cc
@@ -42,6 +42,18 @@
 
 };
 
+// static
+std::string AutofillDownloadManager::AutofillRequestTypeToString(
+    const AutofillRequestType type) {
+  switch (type) {
+    case AutofillDownloadManager::REQUEST_QUERY:
+      return "query";
+    case AutofillDownloadManager::REQUEST_UPLOAD:
+      return "upload";
+  }
+  return std::string();
+}
+
 struct AutofillDownloadManager::FormRequestData {
   std::vector<std::string> form_signatures;
   AutofillRequestType request_type;
@@ -188,6 +200,11 @@
   fetcher->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES |
                         net::LOAD_DO_NOT_SEND_COOKIES);
   fetcher->Start();
+
+  DVLOG(1) << "Sending AutofillDownloadManager "
+           << AutofillRequestTypeToString(request_data.request_type)
+           << " request: " << form_xml;
+
   return true;
 }
 
@@ -255,8 +272,7 @@
     return;
   }
   std::string type_of_request(
-      it->second.request_type == AutofillDownloadManager::REQUEST_QUERY ?
-          "query" : "upload");
+      AutofillRequestTypeToString(it->second.request_type));
   const int kHttpResponseOk = 200;
   const int kHttpInternalServerError = 500;
   const int kHttpBadGateway = 502;
@@ -298,10 +314,11 @@
                                     it->second.request_type,
                                     source->GetResponseCode());
   } else {
-    DVLOG(1) << "AutofillDownloadManager: " << type_of_request
-             << " request has succeeded";
     std::string response_body;
     source->GetResponseAsString(&response_body);
+    DVLOG(1) << "AutofillDownloadManager: " << type_of_request
+             << " request has succeeded with response body: "
+             << response_body;
     if (it->second.request_type == AutofillDownloadManager::REQUEST_QUERY) {
       CacheQueryRequest(it->second.form_signatures, response_body);
       observer_->OnLoadedServerPredictions(response_body);
diff --git a/chrome/browser/autofill/autofill_download.h b/chrome/browser/autofill/autofill_download.h
index cb02e00..d7b1b00 100644
--- a/chrome/browser/autofill/autofill_download.h
+++ b/chrome/browser/autofill/autofill_download.h
@@ -86,6 +86,8 @@
   friend class AutofillDownloadTest;
   FRIEND_TEST_ALL_PREFIXES(AutofillDownloadTest, QueryAndUploadTest);
 
+  static std::string AutofillRequestTypeToString(const AutofillRequestType);
+
   struct FormRequestData;
   typedef std::list<std::pair<std::string, std::string> > QueryRequestCache;