Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1973)

Unified Diff: chrome/browser/autofill/autofill_download_unittest.cc

Issue 11230060: Adding commandline switch and user pref for autofill server url. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/autofill/autofill_download_unittest.cc
diff --git a/chrome/browser/autofill/autofill_download_unittest.cc b/chrome/browser/autofill/autofill_download_unittest.cc
index 51f3740328e184c2c90e04a567162c67d44cf055..5faa4d237ce87f183a27eff13e39ea99e6234214 100644
--- a/chrome/browser/autofill/autofill_download_unittest.cc
+++ b/chrome/browser/autofill/autofill_download_unittest.cc
@@ -16,6 +16,7 @@
#include "chrome/common/form_data.h"
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile.h"
+#include "chrome/test/base/testing_pref_service.h"
Albert Bodenhamer 2012/10/23 23:34:17 Alphabetize
ahutter 2012/10/24 17:33:45 Reverting all changes to this file.
#include "content/public/test/test_browser_thread.h"
#include "net/url_request/test_url_fetcher_factory.h"
#include "net/url_request/url_request_status.h"
@@ -25,6 +26,8 @@
using content::BrowserThread;
using WebKit::WebInputElement;
+using testing::HasSubstr;
+using testing::Not;
namespace {
@@ -52,6 +55,42 @@ void FakeOnURLFetchComplete(net::TestURLFetcher* fetcher,
} // namespace
+class AutofillDownloadUrlTest : public testing::Test {
+ public:
+ AutofillDownloadUrlTest() {}
+
+ protected:
+ virtual void SetUp() {
+ pref_service_.reset(new TestingPrefService());
+ }
+
+ scoped_ptr<TestingPrefService> pref_service_;
+};
+
+TEST_F(AutofillDownloadUrlTest, CheckDefaultUrls) {
+ std::string request_url =
+ AutofillDownloadUrl(pref_service_.get()).
+ GetAutofillRequestUrl().spec();
+ EXPECT_THAT(request_url, HasSubstr("clients1.google.com"));
+ EXPECT_THAT(request_url, HasSubstr("/tbproxy/"));
+ EXPECT_THAT(request_url, HasSubstr("/af/"));
+ EXPECT_THAT(request_url, HasSubstr("/query"));
+ EXPECT_THAT(request_url, Not(HasSubstr("/upload")));
+ EXPECT_THAT(request_url, HasSubstr("?client="));
+
+
+ std::string upload_url =
+ AutofillDownloadUrl(pref_service_.get()).
+ GetAutofillUploadUrl().spec();
+ EXPECT_THAT(upload_url, HasSubstr("clients1.google.com"));
+ EXPECT_THAT(upload_url, HasSubstr("/tbproxy/"));
+ EXPECT_THAT(upload_url, HasSubstr("/af/"));
+ EXPECT_THAT(upload_url, HasSubstr("/upload"));
+ EXPECT_THAT(upload_url, Not(HasSubstr("/query")));
+ EXPECT_THAT(upload_url, HasSubstr("?client="));
+}
Ilya Sherman 2012/10/23 23:45:13 nit: Since this code is testing the AutofillDownlo
ahutter 2012/10/24 17:33:45 Reverting all changes to this file.
+
+
// This tests AutofillDownloadManager. AutofillDownloadTest implements
// AutofillDownloadManager::Observer and creates an instance of
// AutofillDownloadManager. Then it records responses to different initiated

Powered by Google App Engine
This is Rietveld 408576698