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

Side by Side Diff: chrome/browser/metrics/variations/variations_service_unittest.cc

Issue 1172183002: Move StartsWith[ASCII] to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@string_util3
Patch Set: merger Created 5 years, 6 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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/metrics/variations/variations_service.h" 5 #include "chrome/browser/metrics/variations/variations_service.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/prefs/testing_pref_service.h" 10 #include "base/prefs/testing_pref_service.h"
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 }; 236 };
237 237
238 TEST_F(VariationsServiceTest, GetVariationsServerURL) { 238 TEST_F(VariationsServiceTest, GetVariationsServerURL) {
239 TestVariationsPrefsStore prefs_store; 239 TestVariationsPrefsStore prefs_store;
240 PrefService* prefs = prefs_store.prefs(); 240 PrefService* prefs = prefs_store.prefs();
241 const std::string default_variations_url = 241 const std::string default_variations_url =
242 VariationsService::GetDefaultVariationsServerURLForTesting(); 242 VariationsService::GetDefaultVariationsServerURLForTesting();
243 243
244 std::string value; 244 std::string value;
245 GURL url = VariationsService::GetVariationsServerURL(prefs, std::string()); 245 GURL url = VariationsService::GetVariationsServerURL(prefs, std::string());
246 EXPECT_TRUE(StartsWithASCII(url.spec(), default_variations_url, true)); 246 EXPECT_TRUE(base::StartsWithASCII(url.spec(), default_variations_url, true));
247 EXPECT_FALSE(net::GetValueForKeyInQuery(url, "restrict", &value)); 247 EXPECT_FALSE(net::GetValueForKeyInQuery(url, "restrict", &value));
248 248
249 prefs_store.SetVariationsRestrictParameterPolicyValue("restricted"); 249 prefs_store.SetVariationsRestrictParameterPolicyValue("restricted");
250 url = VariationsService::GetVariationsServerURL(prefs, std::string()); 250 url = VariationsService::GetVariationsServerURL(prefs, std::string());
251 EXPECT_TRUE(StartsWithASCII(url.spec(), default_variations_url, true)); 251 EXPECT_TRUE(base::StartsWithASCII(url.spec(), default_variations_url, true));
252 EXPECT_TRUE(net::GetValueForKeyInQuery(url, "restrict", &value)); 252 EXPECT_TRUE(net::GetValueForKeyInQuery(url, "restrict", &value));
253 EXPECT_EQ("restricted", value); 253 EXPECT_EQ("restricted", value);
254 254
255 // The override value should take precedence over what's in prefs. 255 // The override value should take precedence over what's in prefs.
256 url = VariationsService::GetVariationsServerURL(prefs, "override"); 256 url = VariationsService::GetVariationsServerURL(prefs, "override");
257 EXPECT_TRUE(StartsWithASCII(url.spec(), default_variations_url, true)); 257 EXPECT_TRUE(base::StartsWithASCII(url.spec(), default_variations_url, true));
258 EXPECT_TRUE(net::GetValueForKeyInQuery(url, "restrict", &value)); 258 EXPECT_TRUE(net::GetValueForKeyInQuery(url, "restrict", &value));
259 EXPECT_EQ("override", value); 259 EXPECT_EQ("override", value);
260 } 260 }
261 261
262 TEST_F(VariationsServiceTest, VariationsURLHasOSNameParam) { 262 TEST_F(VariationsServiceTest, VariationsURLHasOSNameParam) {
263 TestingPrefServiceSimple prefs; 263 TestingPrefServiceSimple prefs;
264 VariationsService::RegisterPrefs(prefs.registry()); 264 VariationsService::RegisterPrefs(prefs.registry());
265 const GURL url = 265 const GURL url =
266 VariationsService::GetVariationsServerURL(&prefs, std::string()); 266 VariationsService::GetVariationsServerURL(&prefs, std::string());
267 267
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 EXPECT_TRUE(expected_list_value.Equals( 504 EXPECT_TRUE(expected_list_value.Equals(
505 prefs.GetList(prefs::kVariationsPermanentConsistencyCountry))); 505 prefs.GetList(prefs::kVariationsPermanentConsistencyCountry)));
506 506
507 histogram_tester.ExpectUniqueSample( 507 histogram_tester.ExpectUniqueSample(
508 "Variations.LoadPermanentConsistencyCountryResult", 508 "Variations.LoadPermanentConsistencyCountryResult",
509 test.expected_result, 1); 509 test.expected_result, 1);
510 } 510 }
511 } 511 }
512 512
513 } // namespace chrome_variations 513 } // namespace chrome_variations
OLDNEW
« no previous file with comments | « chrome/browser/media_galleries/media_folder_finder.cc ('k') | chrome/browser/net/async_dns_field_trial.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698