| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 } | 142 } |
| 143 | 143 |
| 144 void OnSendResponse(UIThreadExtensionFunction* function, | 144 void OnSendResponse(UIThreadExtensionFunction* function, |
| 145 bool success, | 145 bool success, |
| 146 bool bad_message) override { | 146 bool bad_message) override { |
| 147 ASSERT_FALSE(bad_message); | 147 ASSERT_FALSE(bad_message); |
| 148 ASSERT_FALSE(HasResponse()); | 148 ASSERT_FALSE(HasResponse()); |
| 149 response_.reset(new bool); | 149 response_.reset(new bool); |
| 150 *response_ = success; | 150 *response_ = success; |
| 151 if (should_post_quit_) { | 151 if (should_post_quit_) { |
| 152 base::MessageLoopForUI::current()->Quit(); | 152 base::MessageLoopForUI::current()->QuitWhenIdle(); |
| 153 } | 153 } |
| 154 } | 154 } |
| 155 | 155 |
| 156 private: | 156 private: |
| 157 scoped_ptr<bool> response_; | 157 scoped_ptr<bool> response_; |
| 158 bool should_post_quit_; | 158 bool should_post_quit_; |
| 159 }; | 159 }; |
| 160 | 160 |
| 161 bool RunFunction(UIThreadExtensionFunction* function, | 161 bool RunFunction(UIThreadExtensionFunction* function, |
| 162 const std::string& args, | 162 const std::string& args, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 180 // only one place. See crbug.com/394840. | 180 // only one place. See crbug.com/394840. |
| 181 return extensions::api_test_utils::RunFunction( | 181 return extensions::api_test_utils::RunFunction( |
| 182 function, | 182 function, |
| 183 args.Pass(), | 183 args.Pass(), |
| 184 browser->profile(), | 184 browser->profile(), |
| 185 dispatcher.Pass(), | 185 dispatcher.Pass(), |
| 186 static_cast<extensions::api_test_utils::RunFunctionFlags>(flags)); | 186 static_cast<extensions::api_test_utils::RunFunctionFlags>(flags)); |
| 187 } | 187 } |
| 188 | 188 |
| 189 } // namespace extension_function_test_utils | 189 } // namespace extension_function_test_utils |
| OLD | NEW |