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

Side by Side Diff: chrome/browser/extensions/extension_function_test_utils.cc

Issue 473363003: Adding support for args as ListValues in extension_function_test_utils. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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/extensions/extension_function_test_utils.h" 5 #include "chrome/browser/extensions/extension_function_test_utils.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 235
236 private: 236 private:
237 scoped_ptr<bool> response_; 237 scoped_ptr<bool> response_;
238 bool should_post_quit_; 238 bool should_post_quit_;
239 }; 239 };
240 240
241 bool RunFunction(UIThreadExtensionFunction* function, 241 bool RunFunction(UIThreadExtensionFunction* function,
242 const std::string& args, 242 const std::string& args,
243 Browser* browser, 243 Browser* browser,
244 RunFunctionFlags flags) { 244 RunFunctionFlags flags) {
245 scoped_ptr<base::ListValue> parsed_args(ParseList(args));
246 EXPECT_TRUE(parsed_args.get())
247 << "Could not parse extension function arguments: " << args;
248 return RunFunction(function, parsed_args.Pass(), browser, flags);
249 }
250
251 bool RunFunction(UIThreadExtensionFunction* function,
252 scoped_ptr<base::ListValue> args,
253 Browser* browser,
254 RunFunctionFlags flags) {
245 TestFunctionDispatcherDelegate dispatcher_delegate(browser); 255 TestFunctionDispatcherDelegate dispatcher_delegate(browser);
246 scoped_ptr<extensions::ExtensionFunctionDispatcher> dispatcher( 256 scoped_ptr<extensions::ExtensionFunctionDispatcher> dispatcher(
247 new extensions::ExtensionFunctionDispatcher(browser->profile(), 257 new extensions::ExtensionFunctionDispatcher(browser->profile(),
248 &dispatcher_delegate)); 258 &dispatcher_delegate));
249 // TODO(yoz): The cast is a hack; these flags should be defined in 259 // TODO(yoz): The cast is a hack; these flags should be defined in
250 // only one place. See crbug.com/394840. 260 // only one place. See crbug.com/394840.
251 return extensions::api_test_utils::RunFunction( 261 return extensions::api_test_utils::RunFunction(
252 function, 262 function,
253 args, 263 args.Pass(),
254 browser->profile(), 264 browser->profile(),
255 dispatcher.Pass(), 265 dispatcher.Pass(),
256 static_cast<extensions::api_test_utils::RunFunctionFlags>(flags)); 266 static_cast<extensions::api_test_utils::RunFunctionFlags>(flags));
257 } 267 }
258 268
259 } // namespace extension_function_test_utils 269 } // namespace extension_function_test_utils
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_function_test_utils.h ('k') | extensions/browser/api_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698