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/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 return response_.get() != NULL; | 215 return response_.get() != NULL; |
216 } | 216 } |
217 | 217 |
218 bool GetResponse() { | 218 bool GetResponse() { |
219 EXPECT_TRUE(HasResponse()); | 219 EXPECT_TRUE(HasResponse()); |
220 return *response_.get(); | 220 return *response_.get(); |
221 } | 221 } |
222 | 222 |
223 virtual void OnSendResponse(UIThreadExtensionFunction* function, | 223 virtual void OnSendResponse(UIThreadExtensionFunction* function, |
224 bool success, | 224 bool success, |
225 bool bad_message) { | 225 bool bad_message) OVERRIDE { |
226 ASSERT_FALSE(bad_message); | 226 ASSERT_FALSE(bad_message); |
227 ASSERT_FALSE(HasResponse()); | 227 ASSERT_FALSE(HasResponse()); |
228 response_.reset(new bool); | 228 response_.reset(new bool); |
229 *response_ = success; | 229 *response_ = success; |
230 if (should_post_quit_) { | 230 if (should_post_quit_) { |
231 MessageLoopForUI::current()->Quit(); | 231 MessageLoopForUI::current()->Quit(); |
232 } | 232 } |
233 } | 233 } |
234 | 234 |
235 private: | 235 private: |
(...skipping 26 matching lines...) Expand all Loading... |
262 if (!response_delegate.HasResponse()) { | 262 if (!response_delegate.HasResponse()) { |
263 response_delegate.set_should_post_quit(true); | 263 response_delegate.set_should_post_quit(true); |
264 content::RunMessageLoop(); | 264 content::RunMessageLoop(); |
265 } | 265 } |
266 | 266 |
267 EXPECT_TRUE(response_delegate.HasResponse()); | 267 EXPECT_TRUE(response_delegate.HasResponse()); |
268 return response_delegate.GetResponse(); | 268 return response_delegate.GetResponse(); |
269 } | 269 } |
270 | 270 |
271 } // namespace extension_function_test_utils | 271 } // namespace extension_function_test_utils |
OLD | NEW |