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

Side by Side Diff: chrome/browser/extensions/api/developer_private/developer_private_api_unittest.cc

Issue 2323993004: Remove use of deprecated base::ListValue::Append(Value*) overload in extensions. (Closed)
Patch Set: Less explosions Created 4 years, 3 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 "chrome/browser/extensions/api/developer_private/developer_private_api. h" 5 #include "chrome/browser/extensions/api/developer_private/developer_private_api. h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 } 172 }
173 173
174 void DeveloperPrivateApiUnitTest::TestExtensionPrefSetting( 174 void DeveloperPrivateApiUnitTest::TestExtensionPrefSetting(
175 const base::Callback<bool()>& has_pref, 175 const base::Callback<bool()>& has_pref,
176 const std::string& key, 176 const std::string& key,
177 const std::string& extension_id) { 177 const std::string& extension_id) {
178 scoped_refptr<UIThreadExtensionFunction> function( 178 scoped_refptr<UIThreadExtensionFunction> function(
179 new api::DeveloperPrivateUpdateExtensionConfigurationFunction()); 179 new api::DeveloperPrivateUpdateExtensionConfigurationFunction());
180 180
181 base::ListValue args; 181 base::ListValue args;
182 base::DictionaryValue* parameters = new base::DictionaryValue(); 182 std::unique_ptr<base::DictionaryValue> parameters(
183 new base::DictionaryValue());
183 parameters->SetString("extensionId", extension_id); 184 parameters->SetString("extensionId", extension_id);
184 parameters->SetBoolean(key, true); 185 parameters->SetBoolean(key, true);
185 args.Append(parameters); 186 args.Append(std::move(parameters));
186 187
187 EXPECT_FALSE(has_pref.Run()) << key; 188 EXPECT_FALSE(has_pref.Run()) << key;
188 189
189 EXPECT_FALSE(RunFunction(function, args)) << key; 190 EXPECT_FALSE(RunFunction(function, args)) << key;
190 EXPECT_EQ(std::string("This action requires a user gesture."), 191 EXPECT_EQ(std::string("This action requires a user gesture."),
191 function->GetError()); 192 function->GetError());
192 193
193 ExtensionFunction::ScopedUserGestureForTests scoped_user_gesture; 194 ExtensionFunction::ScopedUserGestureForTests scoped_user_gesture;
194 function = new api::DeveloperPrivateUpdateExtensionConfigurationFunction(); 195 function = new api::DeveloperPrivateUpdateExtensionConfigurationFunction();
195 EXPECT_TRUE(RunFunction(function, args)) << key; 196 EXPECT_TRUE(RunFunction(function, args)) << key;
196 EXPECT_TRUE(has_pref.Run()) << key; 197 EXPECT_TRUE(has_pref.Run()) << key;
197 198
198 parameters->SetBoolean(key, false); 199 parameters->SetBoolean(key, false);
Devlin 2016/09/12 19:12:34 badness :(
Devlin 2016/09/12 21:01:30 This one wasn't addressed?
dcheng 2016/09/13 20:54:20 Yeah, I missed this failure in the test runs. Fixe
199 function = new api::DeveloperPrivateUpdateExtensionConfigurationFunction(); 200 function = new api::DeveloperPrivateUpdateExtensionConfigurationFunction();
200 EXPECT_TRUE(RunFunction(function, args)) << key; 201 EXPECT_TRUE(RunFunction(function, args)) << key;
201 EXPECT_FALSE(has_pref.Run()) << key; 202 EXPECT_FALSE(has_pref.Run()) << key;
202 } 203 }
203 204
204 testing::AssertionResult DeveloperPrivateApiUnitTest::TestPackExtensionFunction( 205 testing::AssertionResult DeveloperPrivateApiUnitTest::TestPackExtensionFunction(
205 const base::ListValue& args, 206 const base::ListValue& args,
206 api::developer_private::PackStatus expected_status, 207 api::developer_private::PackStatus expected_status,
207 int expected_flags) { 208 int expected_flags) {
208 scoped_refptr<UIThreadExtensionFunction> function( 209 scoped_refptr<UIThreadExtensionFunction> function(
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 .Append( 561 .Append(
561 DictionaryBuilder().Set("extensionId", extension->id()).Build()) 562 DictionaryBuilder().Set("extensionId", extension->id()).Build())
562 .Build(); 563 .Build();
563 function = new api::DeveloperPrivateDeleteExtensionErrorsFunction(); 564 function = new api::DeveloperPrivateDeleteExtensionErrorsFunction();
564 EXPECT_TRUE(RunFunction(function, *args)) << function->GetError(); 565 EXPECT_TRUE(RunFunction(function, *args)) << function->GetError();
565 // No more errors! 566 // No more errors!
566 EXPECT_TRUE(error_console->GetErrorsForExtension(extension->id()).empty()); 567 EXPECT_TRUE(error_console->GetErrorsForExtension(extension->id()).empty());
567 } 568 }
568 569
569 } // namespace extensions 570 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698