| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/autofill/autofill_download_url.h" |
| 6 #include "chrome/test/base/testing_pref_service.h" |
| 7 #include "googleurl/src/gurl.h" |
| 8 #include "testing/gmock/include/gmock/gmock.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 |
| 11 using testing::HasSubstr; |
| 12 using testing::Not; |
| 13 |
| 14 class AutofillDownloadUrlTest : public testing::Test { |
| 15 public: |
| 16 AutofillDownloadUrlTest() {} |
| 17 |
| 18 protected: |
| 19 virtual void SetUp() { |
| 20 pref_service_.reset(new TestingPrefService()); |
| 21 } |
| 22 |
| 23 scoped_ptr<TestingPrefService> pref_service_; |
| 24 }; |
| 25 |
| 26 TEST_F(AutofillDownloadUrlTest, CheckDefaultUrls) { |
| 27 std::string request_url = |
| 28 AutofillDownloadUrl(pref_service_.get()). |
| 29 GetAutofillRequestUrl().spec(); |
| 30 EXPECT_THAT(request_url, HasSubstr("clients1.google.com")); |
| 31 EXPECT_THAT(request_url, HasSubstr("/tbproxy/")); |
| 32 EXPECT_THAT(request_url, HasSubstr("/af/")); |
| 33 EXPECT_THAT(request_url, HasSubstr("/query")); |
| 34 EXPECT_THAT(request_url, Not(HasSubstr("/upload"))); |
| 35 EXPECT_THAT(request_url, HasSubstr("?client=")); |
| 36 |
| 37 |
| 38 std::string upload_url = |
| 39 AutofillDownloadUrl(pref_service_.get()). |
| 40 GetAutofillUploadUrl().spec(); |
| 41 EXPECT_THAT(upload_url, HasSubstr("clients1.google.com")); |
| 42 EXPECT_THAT(upload_url, HasSubstr("/tbproxy/")); |
| 43 EXPECT_THAT(upload_url, HasSubstr("/af/")); |
| 44 EXPECT_THAT(upload_url, HasSubstr("/upload")); |
| 45 EXPECT_THAT(upload_url, Not(HasSubstr("/query"))); |
| 46 EXPECT_THAT(upload_url, HasSubstr("?client=")); |
| 47 } |
| 48 |
| OLD | NEW |