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

Side by Side Diff: chrome/browser/android/search_geolocation/search_geolocation_service_unittest.cc

Issue 2666093002: Remove base::FundamentalValue (Closed)
Patch Set: Rebase Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « base/values_unittest.cc ('k') | chrome/browser/chromeos/arc/arc_session_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "chrome/browser/android/search_geolocation/search_geolocation_service.h " 5 #include "chrome/browser/android/search_geolocation/search_geolocation_service.h "
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 { 188 {
189 base::test::ScopedFeatureList scoped_feature_list; 189 base::test::ScopedFeatureList scoped_feature_list;
190 scoped_feature_list.InitAndDisableFeature( 190 scoped_feature_list.InitAndDisableFeature(
191 features::kConsistentOmniboxGeolocation); 191 features::kConsistentOmniboxGeolocation);
192 EXPECT_FALSE(GetService()->UseDSEGeolocationSetting(ToOrigin(kGoogleURL))); 192 EXPECT_FALSE(GetService()->UseDSEGeolocationSetting(ToOrigin(kGoogleURL)));
193 } 193 }
194 194
195 // False if the content setting is enterprise ask. 195 // False if the content setting is enterprise ask.
196 profile()->GetTestingPrefService()->SetManagedPref( 196 profile()->GetTestingPrefService()->SetManagedPref(
197 prefs::kManagedDefaultGeolocationSetting, 197 prefs::kManagedDefaultGeolocationSetting,
198 new base::FundamentalValue(CONTENT_SETTING_ASK)); 198 new base::Value(CONTENT_SETTING_ASK));
199 EXPECT_FALSE(GetService()->UseDSEGeolocationSetting(ToOrigin(kGoogleURL))); 199 EXPECT_FALSE(GetService()->UseDSEGeolocationSetting(ToOrigin(kGoogleURL)));
200 } 200 }
201 201
202 TEST_F(SearchGeolocationServiceTest, GetDSEGeolocationSetting) { 202 TEST_F(SearchGeolocationServiceTest, GetDSEGeolocationSetting) {
203 test_delegate()->SetDSECCTLD(kGoogleURL); 203 test_delegate()->SetDSECCTLD(kGoogleURL);
204 204
205 // The case where the pref is set to true. 205 // The case where the pref is set to true.
206 GetService()->SetDSEGeolocationSetting(true); 206 GetService()->SetDSEGeolocationSetting(true);
207 EXPECT_TRUE(GetService()->GetDSEGeolocationSetting()); 207 EXPECT_TRUE(GetService()->GetDSEGeolocationSetting());
208 208
(...skipping 29 matching lines...) Expand all
238 EXPECT_EQ(CONTENT_SETTING_ASK, GetContentSetting(kGoogleURL)); 238 EXPECT_EQ(CONTENT_SETTING_ASK, GetContentSetting(kGoogleURL));
239 239
240 SetContentSetting(kGoogleURL, CONTENT_SETTING_BLOCK); 240 SetContentSetting(kGoogleURL, CONTENT_SETTING_BLOCK);
241 GetService()->SetDSEGeolocationSetting(false); 241 GetService()->SetDSEGeolocationSetting(false);
242 EXPECT_EQ(CONTENT_SETTING_ASK, GetContentSetting(kGoogleURL)); 242 EXPECT_EQ(CONTENT_SETTING_ASK, GetContentSetting(kGoogleURL));
243 243
244 // Check that the pref doesn't change if it's not user settable. 244 // Check that the pref doesn't change if it's not user settable.
245 GetService()->SetDSEGeolocationSetting(true); 245 GetService()->SetDSEGeolocationSetting(true);
246 profile()->GetTestingPrefService()->SetManagedPref( 246 profile()->GetTestingPrefService()->SetManagedPref(
247 prefs::kManagedDefaultGeolocationSetting, 247 prefs::kManagedDefaultGeolocationSetting,
248 new base::FundamentalValue(CONTENT_SETTING_ASK)); 248 new base::Value(CONTENT_SETTING_ASK));
249 EXPECT_TRUE(GetService()->GetDSEGeolocationSetting()); 249 EXPECT_TRUE(GetService()->GetDSEGeolocationSetting());
250 GetService()->SetDSEGeolocationSetting(false); 250 GetService()->SetDSEGeolocationSetting(false);
251 EXPECT_TRUE(GetService()->GetDSEGeolocationSetting()); 251 EXPECT_TRUE(GetService()->GetDSEGeolocationSetting());
252 } 252 }
253 253
254 TEST_F(SearchGeolocationServiceTest, DSEChanges) { 254 TEST_F(SearchGeolocationServiceTest, DSEChanges) {
255 test_delegate()->SetDSECCTLD(kGoogleURL); 255 test_delegate()->SetDSECCTLD(kGoogleURL);
256 EXPECT_TRUE(GetService()->UseDSEGeolocationSetting(ToOrigin(kGoogleURL))); 256 EXPECT_TRUE(GetService()->UseDSEGeolocationSetting(ToOrigin(kGoogleURL)));
257 EXPECT_TRUE(GetService()->GetDSEGeolocationSetting()); 257 EXPECT_TRUE(GetService()->GetDSEGeolocationSetting());
258 258
(...skipping 23 matching lines...) Expand all
282 test_delegate()->SetDSECCTLD(kExampleURL); 282 test_delegate()->SetDSECCTLD(kExampleURL);
283 EXPECT_FALSE(GetService()->UseDSEGeolocationSetting(ToOrigin(kGoogleAusURL))); 283 EXPECT_FALSE(GetService()->UseDSEGeolocationSetting(ToOrigin(kGoogleAusURL)));
284 EXPECT_FALSE(GetService()->UseDSEGeolocationSetting(ToOrigin(kExampleURL))); 284 EXPECT_FALSE(GetService()->UseDSEGeolocationSetting(ToOrigin(kExampleURL)));
285 285
286 // Go back to google.com.au. The setting should still be false because that's 286 // Go back to google.com.au. The setting should still be false because that's
287 // what it last was. 287 // what it last was.
288 test_delegate()->SetDSECCTLD(kGoogleAusURL); 288 test_delegate()->SetDSECCTLD(kGoogleAusURL);
289 EXPECT_TRUE(GetService()->UseDSEGeolocationSetting(ToOrigin(kGoogleAusURL))); 289 EXPECT_TRUE(GetService()->UseDSEGeolocationSetting(ToOrigin(kGoogleAusURL)));
290 EXPECT_FALSE(GetService()->GetDSEGeolocationSetting()); 290 EXPECT_FALSE(GetService()->GetDSEGeolocationSetting());
291 } 291 }
OLDNEW
« no previous file with comments | « base/values_unittest.cc ('k') | chrome/browser/chromeos/arc/arc_session_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698