| 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 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 void set_should_post_quit(bool should_quit) { | 132 void set_should_post_quit(bool should_quit) { |
| 133 should_post_quit_ = should_quit; | 133 should_post_quit_ = should_quit; |
| 134 } | 134 } |
| 135 | 135 |
| 136 bool HasResponse() { | 136 bool HasResponse() { |
| 137 return response_.get() != NULL; | 137 return response_.get() != NULL; |
| 138 } | 138 } |
| 139 | 139 |
| 140 bool GetResponse() { | 140 bool GetResponse() { |
| 141 EXPECT_TRUE(HasResponse()); | 141 EXPECT_TRUE(HasResponse()); |
| 142 return *response_.get(); | 142 return *response_; |
| 143 } | 143 } |
| 144 | 144 |
| 145 void OnSendResponse(UIThreadExtensionFunction* function, | 145 void OnSendResponse(UIThreadExtensionFunction* function, |
| 146 bool success, | 146 bool success, |
| 147 bool bad_message) override { | 147 bool bad_message) override { |
| 148 ASSERT_FALSE(bad_message); | 148 ASSERT_FALSE(bad_message); |
| 149 ASSERT_FALSE(HasResponse()); | 149 ASSERT_FALSE(HasResponse()); |
| 150 response_.reset(new bool); | 150 response_.reset(new bool); |
| 151 *response_ = success; | 151 *response_ = success; |
| 152 if (should_post_quit_) { | 152 if (should_post_quit_) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 178 new extensions::ExtensionFunctionDispatcher(browser->profile())); | 178 new extensions::ExtensionFunctionDispatcher(browser->profile())); |
| 179 dispatcher->set_delegate(&dispatcher_delegate); | 179 dispatcher->set_delegate(&dispatcher_delegate); |
| 180 // TODO(yoz): The cast is a hack; these flags should be defined in | 180 // TODO(yoz): The cast is a hack; these flags should be defined in |
| 181 // only one place. See crbug.com/394840. | 181 // only one place. See crbug.com/394840. |
| 182 return extensions::api_test_utils::RunFunction( | 182 return extensions::api_test_utils::RunFunction( |
| 183 function, std::move(args), browser->profile(), std::move(dispatcher), | 183 function, std::move(args), browser->profile(), std::move(dispatcher), |
| 184 static_cast<extensions::api_test_utils::RunFunctionFlags>(flags)); | 184 static_cast<extensions::api_test_utils::RunFunctionFlags>(flags)); |
| 185 } | 185 } |
| 186 | 186 |
| 187 } // namespace extension_function_test_utils | 187 } // namespace extension_function_test_utils |
| OLD | NEW |