| 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 3231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3242 // Incognito. | 3242 // Incognito. |
| 3243 ChromeAutocompleteProviderClient client_incognito( | 3243 ChromeAutocompleteProviderClient client_incognito( |
| 3244 profile_.GetOffTheRecordProfile()); | 3244 profile_.GetOffTheRecordProfile()); |
| 3245 EXPECT_FALSE(SearchProvider::CanSendURL( | 3245 EXPECT_FALSE(SearchProvider::CanSendURL( |
| 3246 GURL("http://www.google.com/search"), | 3246 GURL("http://www.google.com/search"), |
| 3247 GURL("https://www.google.com/complete/search"), &google_template_url, | 3247 GURL("https://www.google.com/complete/search"), &google_template_url, |
| 3248 metrics::OmniboxEventProto::OTHER, SearchTermsData(), | 3248 metrics::OmniboxEventProto::OTHER, SearchTermsData(), |
| 3249 &client_incognito)); | 3249 &client_incognito)); |
| 3250 | 3250 |
| 3251 // Tab sync not enabled. | 3251 // Tab sync not enabled. |
| 3252 profile_.GetPrefs()->SetBoolean(sync_driver::prefs::kSyncKeepEverythingSynced, | 3252 profile_.GetPrefs()->SetBoolean(syncer::prefs::kSyncKeepEverythingSynced, |
| 3253 false); | 3253 false); |
| 3254 profile_.GetPrefs()->SetBoolean(sync_driver::prefs::kSyncTabs, false); | 3254 profile_.GetPrefs()->SetBoolean(syncer::prefs::kSyncTabs, false); |
| 3255 EXPECT_FALSE(SearchProvider::CanSendURL( | 3255 EXPECT_FALSE(SearchProvider::CanSendURL( |
| 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(sync_driver::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->OnEncryptedTypesChanged(encrypted_types, false); |
| 3267 EXPECT_FALSE(SearchProvider::CanSendURL( | 3267 EXPECT_FALSE(SearchProvider::CanSendURL( |
| 3268 GURL("http://www.google.com/search"), | 3268 GURL("http://www.google.com/search"), |
| 3269 GURL("https://www.google.com/complete/search"), &google_template_url, | 3269 GURL("https://www.google.com/complete/search"), &google_template_url, |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3514 } | 3514 } |
| 3515 | 3515 |
| 3516 TEST_F(SearchProviderTest, DoesNotProvideOnFocus) { | 3516 TEST_F(SearchProviderTest, DoesNotProvideOnFocus) { |
| 3517 AutocompleteInput input( | 3517 AutocompleteInput input( |
| 3518 base::ASCIIToUTF16("f"), base::string16::npos, std::string(), GURL(), | 3518 base::ASCIIToUTF16("f"), base::string16::npos, std::string(), GURL(), |
| 3519 metrics::OmniboxEventProto::INVALID_SPEC, false, true, true, true, true, | 3519 metrics::OmniboxEventProto::INVALID_SPEC, false, true, true, true, true, |
| 3520 ChromeAutocompleteSchemeClassifier(&profile_)); | 3520 ChromeAutocompleteSchemeClassifier(&profile_)); |
| 3521 provider_->Start(input, false); | 3521 provider_->Start(input, false); |
| 3522 EXPECT_TRUE(provider_->matches().empty()); | 3522 EXPECT_TRUE(provider_->matches().empty()); |
| 3523 } | 3523 } |
| OLD | NEW |