| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/api_test_utils.h" | 5 #include "extensions/browser/api_test_utils.h" |
| 6 | 6 |
| 7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "components/crx_file/id_util.h" | 10 #include "components/crx_file/id_util.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 } | 48 } |
| 49 | 49 |
| 50 void OnSendResponse(UIThreadExtensionFunction* function, | 50 void OnSendResponse(UIThreadExtensionFunction* function, |
| 51 bool success, | 51 bool success, |
| 52 bool bad_message) override { | 52 bool bad_message) override { |
| 53 ASSERT_FALSE(bad_message); | 53 ASSERT_FALSE(bad_message); |
| 54 ASSERT_FALSE(HasResponse()); | 54 ASSERT_FALSE(HasResponse()); |
| 55 response_.reset(new bool); | 55 response_.reset(new bool); |
| 56 *response_ = success; | 56 *response_ = success; |
| 57 if (should_post_quit_) { | 57 if (should_post_quit_) { |
| 58 base::MessageLoopForUI::current()->Quit(); | 58 base::MessageLoopForUI::current()->QuitWhenIdle(); |
| 59 } | 59 } |
| 60 } | 60 } |
| 61 | 61 |
| 62 private: | 62 private: |
| 63 scoped_ptr<bool> response_; | 63 scoped_ptr<bool> response_; |
| 64 bool should_post_quit_; | 64 bool should_post_quit_; |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 } // namespace | 67 } // namespace |
| 68 | 68 |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 response_delegate.set_should_post_quit(true); | 235 response_delegate.set_should_post_quit(true); |
| 236 content::RunMessageLoop(); | 236 content::RunMessageLoop(); |
| 237 } | 237 } |
| 238 | 238 |
| 239 EXPECT_TRUE(response_delegate.HasResponse()); | 239 EXPECT_TRUE(response_delegate.HasResponse()); |
| 240 return response_delegate.GetResponse(); | 240 return response_delegate.GetResponse(); |
| 241 } | 241 } |
| 242 | 242 |
| 243 } // namespace api_test_utils | 243 } // namespace api_test_utils |
| 244 } // namespace extensions | 244 } // namespace extensions |
| OLD | NEW |