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

Side by Side Diff: chrome/browser/extensions/api/experience_sampling_private/experience_sampling_private_api_unittest.cc

Issue 1871713002: Convert //chrome/browser/extensions from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and fix header Created 4 years, 8 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/metrics/field_trial.h" 5 #include "base/metrics/field_trial.h"
6 #include "chrome/browser/extensions/api/experience_sampling_private/experience_s ampling_private_api.h" 6 #include "chrome/browser/extensions/api/experience_sampling_private/experience_s ampling_private_api.h"
7 #include "chrome/browser/extensions/extension_api_unittest.h" 7 #include "chrome/browser/extensions/extension_api_unittest.h"
8 #include "chrome/browser/extensions/extension_function_test_utils.h" 8 #include "chrome/browser/extensions/extension_function_test_utils.h"
9 9
10 10
11 namespace utils = extension_function_test_utils; 11 namespace utils = extension_function_test_utils;
12 12
13 namespace extensions { 13 namespace extensions {
14 14
15 typedef ExtensionApiUnittest ExperienceSamplingPrivateTest; 15 typedef ExtensionApiUnittest ExperienceSamplingPrivateTest;
16 16
17 // Tests that chrome.experienceSamplingPrivate.getBrowserInfo() returns expected 17 // Tests that chrome.experienceSamplingPrivate.getBrowserInfo() returns expected
18 // field trials and groups. 18 // field trials and groups.
19 TEST_F(ExperienceSamplingPrivateTest, GetBrowserInfoTest) { 19 TEST_F(ExperienceSamplingPrivateTest, GetBrowserInfoTest) {
20 // Start with an empty FieldTrialList. 20 // Start with an empty FieldTrialList.
21 scoped_ptr<base::FieldTrialList> trial_list(new base::FieldTrialList(NULL)); 21 std::unique_ptr<base::FieldTrialList> trial_list(
22 scoped_ptr<base::DictionaryValue> result(RunFunctionAndReturnDictionary( 22 new base::FieldTrialList(NULL));
23 std::unique_ptr<base::DictionaryValue> result(RunFunctionAndReturnDictionary(
23 new ExperienceSamplingPrivateGetBrowserInfoFunction(), "[]")); 24 new ExperienceSamplingPrivateGetBrowserInfoFunction(), "[]"));
24 ASSERT_TRUE(result->HasKey("variations")); 25 ASSERT_TRUE(result->HasKey("variations"));
25 std::string trials_string; 26 std::string trials_string;
26 EXPECT_TRUE(result->GetStringWithoutPathExpansion("variations", 27 EXPECT_TRUE(result->GetStringWithoutPathExpansion("variations",
27 &trials_string)); 28 &trials_string));
28 ASSERT_EQ("", trials_string); 29 ASSERT_EQ("", trials_string);
29 30
30 // Set field trials using a string. 31 // Set field trials using a string.
31 base::FieldTrialList::CreateTrialsFromString( 32 base::FieldTrialList::CreateTrialsFromString(
32 "*Some name/Winner/*xxx/yyyy/*zzz/default/", 33 "*Some name/Winner/*xxx/yyyy/*zzz/default/",
33 std::set<std::string>()); 34 std::set<std::string>());
34 result = RunFunctionAndReturnDictionary( 35 result = RunFunctionAndReturnDictionary(
35 new ExperienceSamplingPrivateGetBrowserInfoFunction(), "[]"); 36 new ExperienceSamplingPrivateGetBrowserInfoFunction(), "[]");
36 ASSERT_TRUE(result->HasKey("variations")); 37 ASSERT_TRUE(result->HasKey("variations"));
37 EXPECT_TRUE(result->GetStringWithoutPathExpansion("variations", 38 EXPECT_TRUE(result->GetStringWithoutPathExpansion("variations",
38 &trials_string)); 39 &trials_string));
39 ASSERT_EQ("Some name/Winner/xxx/yyyy/zzz/default/", trials_string); 40 ASSERT_EQ("Some name/Winner/xxx/yyyy/zzz/default/", trials_string);
40 } 41 }
41 42
42 } // namespace extensions 43 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698