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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 } | 222 } |
223 | 223 |
224 virtual void OnSendResponse(UIThreadExtensionFunction* function, | 224 virtual void OnSendResponse(UIThreadExtensionFunction* function, |
225 bool success, | 225 bool success, |
226 bool bad_message) OVERRIDE { | 226 bool bad_message) OVERRIDE { |
227 ASSERT_FALSE(bad_message); | 227 ASSERT_FALSE(bad_message); |
228 ASSERT_FALSE(HasResponse()); | 228 ASSERT_FALSE(HasResponse()); |
229 response_.reset(new bool); | 229 response_.reset(new bool); |
230 *response_ = success; | 230 *response_ = success; |
231 if (should_post_quit_) { | 231 if (should_post_quit_) { |
232 MessageLoopForUI::current()->Quit(); | 232 base::MessageLoopForUI::current()->Quit(); |
233 } | 233 } |
234 } | 234 } |
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, |
(...skipping 20 matching lines...) Expand all Loading... |
263 if (!response_delegate.HasResponse()) { | 263 if (!response_delegate.HasResponse()) { |
264 response_delegate.set_should_post_quit(true); | 264 response_delegate.set_should_post_quit(true); |
265 content::RunMessageLoop(); | 265 content::RunMessageLoop(); |
266 } | 266 } |
267 | 267 |
268 EXPECT_TRUE(response_delegate.HasResponse()); | 268 EXPECT_TRUE(response_delegate.HasResponse()); |
269 return response_delegate.GetResponse(); | 269 return response_delegate.GetResponse(); |
270 } | 270 } |
271 | 271 |
272 } // namespace extension_function_test_utils | 272 } // namespace extension_function_test_utils |
OLD | NEW |