| OLD | NEW |
| 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 << "Could not parse extension function arguments: " << args; | 169 << "Could not parse extension function arguments: " << args; |
| 170 return RunFunction(function, parsed_args.Pass(), browser, flags); | 170 return RunFunction(function, parsed_args.Pass(), browser, flags); |
| 171 } | 171 } |
| 172 | 172 |
| 173 bool RunFunction(UIThreadExtensionFunction* function, | 173 bool RunFunction(UIThreadExtensionFunction* function, |
| 174 scoped_ptr<base::ListValue> args, | 174 scoped_ptr<base::ListValue> args, |
| 175 Browser* browser, | 175 Browser* browser, |
| 176 RunFunctionFlags flags) { | 176 RunFunctionFlags flags) { |
| 177 TestFunctionDispatcherDelegate dispatcher_delegate(browser); | 177 TestFunctionDispatcherDelegate dispatcher_delegate(browser); |
| 178 scoped_ptr<extensions::ExtensionFunctionDispatcher> dispatcher( | 178 scoped_ptr<extensions::ExtensionFunctionDispatcher> dispatcher( |
| 179 new extensions::ExtensionFunctionDispatcher(browser->profile(), | 179 new extensions::ExtensionFunctionDispatcher(browser->profile())); |
| 180 &dispatcher_delegate)); | 180 dispatcher->set_delegate(&dispatcher_delegate); |
| 181 // TODO(yoz): The cast is a hack; these flags should be defined in | 181 // TODO(yoz): The cast is a hack; these flags should be defined in |
| 182 // only one place. See crbug.com/394840. | 182 // only one place. See crbug.com/394840. |
| 183 return extensions::api_test_utils::RunFunction( | 183 return extensions::api_test_utils::RunFunction( |
| 184 function, | 184 function, |
| 185 args.Pass(), | 185 args.Pass(), |
| 186 browser->profile(), | 186 browser->profile(), |
| 187 dispatcher.Pass(), | 187 dispatcher.Pass(), |
| 188 static_cast<extensions::api_test_utils::RunFunctionFlags>(flags)); | 188 static_cast<extensions::api_test_utils::RunFunctionFlags>(flags)); |
| 189 } | 189 } |
| 190 | 190 |
| 191 } // namespace extension_function_test_utils | 191 } // namespace extension_function_test_utils |
| OLD | NEW |