| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/omnibox/browser/search_provider.h" | 5 #include "components/omnibox/browser/search_provider.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 3245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3256 GURL("http://www.google.com/search"), | 3256 GURL("http://www.google.com/search"), |
| 3257 GURL("https://www.google.com/complete/search"), &google_template_url, | 3257 GURL("https://www.google.com/complete/search"), &google_template_url, |
| 3258 metrics::OmniboxEventProto::OTHER, SearchTermsData(), &client)); | 3258 metrics::OmniboxEventProto::OTHER, SearchTermsData(), &client)); |
| 3259 profile_.GetPrefs()->SetBoolean(syncer::prefs::kSyncTabs, true); | 3259 profile_.GetPrefs()->SetBoolean(syncer::prefs::kSyncTabs, true); |
| 3260 | 3260 |
| 3261 // Tab sync is encrypted. | 3261 // Tab sync is encrypted. |
| 3262 browser_sync::ProfileSyncService* service = | 3262 browser_sync::ProfileSyncService* service = |
| 3263 ProfileSyncServiceFactory::GetInstance()->GetForProfile(&profile_); | 3263 ProfileSyncServiceFactory::GetInstance()->GetForProfile(&profile_); |
| 3264 syncer::ModelTypeSet encrypted_types = service->GetEncryptedDataTypes(); | 3264 syncer::ModelTypeSet encrypted_types = service->GetEncryptedDataTypes(); |
| 3265 encrypted_types.Put(syncer::SESSIONS); | 3265 encrypted_types.Put(syncer::SESSIONS); |
| 3266 service->OnEncryptedTypesChanged(encrypted_types, false); | 3266 service->GetEncryptionObserverForTest()->OnEncryptedTypesChanged( |
| 3267 encrypted_types, false); |
| 3267 EXPECT_FALSE(SearchProvider::CanSendURL( | 3268 EXPECT_FALSE(SearchProvider::CanSendURL( |
| 3268 GURL("http://www.google.com/search"), | 3269 GURL("http://www.google.com/search"), |
| 3269 GURL("https://www.google.com/complete/search"), &google_template_url, | 3270 GURL("https://www.google.com/complete/search"), &google_template_url, |
| 3270 metrics::OmniboxEventProto::OTHER, SearchTermsData(), &client)); | 3271 metrics::OmniboxEventProto::OTHER, SearchTermsData(), &client)); |
| 3271 encrypted_types.Remove(syncer::SESSIONS); | 3272 encrypted_types.Remove(syncer::SESSIONS); |
| 3272 service->OnEncryptedTypesChanged(encrypted_types, false); | 3273 service->GetEncryptionObserverForTest()->OnEncryptedTypesChanged( |
| 3274 encrypted_types, false); |
| 3273 | 3275 |
| 3274 // Check that there were no side effects from previous tests. | 3276 // Check that there were no side effects from previous tests. |
| 3275 EXPECT_TRUE(SearchProvider::CanSendURL( | 3277 EXPECT_TRUE(SearchProvider::CanSendURL( |
| 3276 GURL("http://www.google.com/search"), | 3278 GURL("http://www.google.com/search"), |
| 3277 GURL("https://www.google.com/complete/search"), &google_template_url, | 3279 GURL("https://www.google.com/complete/search"), &google_template_url, |
| 3278 metrics::OmniboxEventProto::OTHER, SearchTermsData(), &client)); | 3280 metrics::OmniboxEventProto::OTHER, SearchTermsData(), &client)); |
| 3279 } | 3281 } |
| 3280 | 3282 |
| 3281 TEST_F(SearchProviderTest, TestDeleteMatch) { | 3283 TEST_F(SearchProviderTest, TestDeleteMatch) { |
| 3282 AutocompleteMatch match( | 3284 AutocompleteMatch match( |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3514 } | 3516 } |
| 3515 | 3517 |
| 3516 TEST_F(SearchProviderTest, DoesNotProvideOnFocus) { | 3518 TEST_F(SearchProviderTest, DoesNotProvideOnFocus) { |
| 3517 AutocompleteInput input( | 3519 AutocompleteInput input( |
| 3518 base::ASCIIToUTF16("f"), base::string16::npos, std::string(), GURL(), | 3520 base::ASCIIToUTF16("f"), base::string16::npos, std::string(), GURL(), |
| 3519 metrics::OmniboxEventProto::INVALID_SPEC, false, true, true, true, true, | 3521 metrics::OmniboxEventProto::INVALID_SPEC, false, true, true, true, true, |
| 3520 ChromeAutocompleteSchemeClassifier(&profile_)); | 3522 ChromeAutocompleteSchemeClassifier(&profile_)); |
| 3521 provider_->Start(input, false); | 3523 provider_->Start(input, false); |
| 3522 EXPECT_TRUE(provider_->matches().empty()); | 3524 EXPECT_TRUE(provider_->matches().empty()); |
| 3523 } | 3525 } |
| OLD | NEW |