| 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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 "Could not parse extension function arguments: " << args; | 250 "Could not parse extension function arguments: " << args; |
| 251 function->SetArgs(parsed_args.get()); | 251 function->SetArgs(parsed_args.get()); |
| 252 | 252 |
| 253 TestFunctionDispatcherDelegate dispatcher_delegate(browser); | 253 TestFunctionDispatcherDelegate dispatcher_delegate(browser); |
| 254 extensions::ExtensionFunctionDispatcher dispatcher(browser->profile(), | 254 extensions::ExtensionFunctionDispatcher dispatcher(browser->profile(), |
| 255 &dispatcher_delegate); | 255 &dispatcher_delegate); |
| 256 function->set_dispatcher(dispatcher.AsWeakPtr()); | 256 function->set_dispatcher(dispatcher.AsWeakPtr()); |
| 257 | 257 |
| 258 function->set_browser_context(browser->profile()); | 258 function->set_browser_context(browser->profile()); |
| 259 function->set_include_incognito(flags & INCLUDE_INCOGNITO); | 259 function->set_include_incognito(flags & INCLUDE_INCOGNITO); |
| 260 function->Run(); | 260 function->Run()->Execute(); |
| 261 | 261 |
| 262 // If the RunImpl of |function| didn't already call SendResponse, run the | 262 // If the RunAsync of |function| didn't already call SendResponse, run the |
| 263 // message loop until they do. | 263 // message loop until they do. |
| 264 if (!response_delegate.HasResponse()) { | 264 if (!response_delegate.HasResponse()) { |
| 265 response_delegate.set_should_post_quit(true); | 265 response_delegate.set_should_post_quit(true); |
| 266 content::RunMessageLoop(); | 266 content::RunMessageLoop(); |
| 267 } | 267 } |
| 268 | 268 |
| 269 EXPECT_TRUE(response_delegate.HasResponse()); | 269 EXPECT_TRUE(response_delegate.HasResponse()); |
| 270 return response_delegate.GetResponse(); | 270 return response_delegate.GetResponse(); |
| 271 } | 271 } |
| 272 | 272 |
| 273 } // namespace extension_function_test_utils | 273 } // namespace extension_function_test_utils |
| OLD | NEW |