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

Side by Side Diff: chrome/browser/extensions/api/settings_private/settings_private_apitest.cc

Issue 1129083003: More base::Values-related bare pointer -> scoped_ptr conversions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix bad merge Created 5 years, 7 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/command_line.h" 5 #include "base/command_line.h"
6 #include "base/prefs/pref_service.h" 6 #include "base/prefs/pref_service.h"
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "chrome/browser/extensions/api/settings_private/settings_private_delega te.h" 8 #include "chrome/browser/extensions/api/settings_private/settings_private_delega te.h"
9 #include "chrome/browser/extensions/api/settings_private/settings_private_delega te_factory.h" 9 #include "chrome/browser/extensions/api/settings_private/settings_private_delega te_factory.h"
10 #include "chrome/browser/extensions/extension_apitest.h" 10 #include "chrome/browser/extensions/extension_apitest.h"
(...skipping 16 matching lines...) Expand all
27 bool SetPref(const std::string& name, const base::Value* value) override { 27 bool SetPref(const std::string& name, const base::Value* value) override {
28 // Write to the actual pref service, so that the SettingsPrivateEventRouter 28 // Write to the actual pref service, so that the SettingsPrivateEventRouter
29 // dispatches an onPrefsChanged event. 29 // dispatches an onPrefsChanged event.
30 PrefService* pref_service = profile_->GetPrefs(); 30 PrefService* pref_service = profile_->GetPrefs();
31 pref_service->Set(name.c_str(), *value); 31 pref_service->Set(name.c_str(), *value);
32 return true; 32 return true;
33 } 33 }
34 34
35 scoped_ptr<base::Value> GetPref(const std::string& name) override { 35 scoped_ptr<base::Value> GetPref(const std::string& name) override {
36 if (name.compare(kTestPrefName) != 0) 36 if (name.compare(kTestPrefName) != 0)
37 return make_scoped_ptr(base::Value::CreateNullValue()); 37 return base::Value::CreateNullValue();
38 38
39 return CreateTestPrefObject()->ToValue(); 39 return CreateTestPrefObject()->ToValue();
40 } 40 }
41 41
42 scoped_ptr<base::Value> GetAllPrefs() override { 42 scoped_ptr<base::Value> GetAllPrefs() override {
43 base::ListValue* list_value = new base::ListValue(); 43 base::ListValue* list_value = new base::ListValue();
44 list_value->Append(CreateTestPrefObject()->ToValue().release()); 44 list_value->Append(CreateTestPrefObject()->ToValue().release());
45 return make_scoped_ptr(list_value); 45 return make_scoped_ptr(list_value);
46 } 46 }
47 47
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 115
116 IN_PROC_BROWSER_TEST_F(SettingsPrivateApiTest, GetAllPrefs) { 116 IN_PROC_BROWSER_TEST_F(SettingsPrivateApiTest, GetAllPrefs) {
117 EXPECT_TRUE(RunSettingsSubtest("getAllPrefs")) << message_; 117 EXPECT_TRUE(RunSettingsSubtest("getAllPrefs")) << message_;
118 } 118 }
119 119
120 IN_PROC_BROWSER_TEST_F(SettingsPrivateApiTest, OnPrefsChanged) { 120 IN_PROC_BROWSER_TEST_F(SettingsPrivateApiTest, OnPrefsChanged) {
121 EXPECT_TRUE(RunSettingsSubtest("onPrefsChanged")) << message_; 121 EXPECT_TRUE(RunSettingsSubtest("onPrefsChanged")) << message_;
122 } 122 }
123 123
124 } // namespace extensions 124 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698