| 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 "content/public/browser/browser_context.h" | 10 #include "content/public/browser/browser_context.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 | 55 |
| 56 bool HasResponse() { return response_.get() != NULL; } | 56 bool HasResponse() { return response_.get() != NULL; } |
| 57 | 57 |
| 58 bool GetResponse() { | 58 bool GetResponse() { |
| 59 EXPECT_TRUE(HasResponse()); | 59 EXPECT_TRUE(HasResponse()); |
| 60 return *response_.get(); | 60 return *response_.get(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 virtual void OnSendResponse(UIThreadExtensionFunction* function, | 63 virtual void OnSendResponse(UIThreadExtensionFunction* function, |
| 64 bool success, | 64 bool success, |
| 65 bool bad_message) OVERRIDE { | 65 bool bad_message) override { |
| 66 ASSERT_FALSE(bad_message); | 66 ASSERT_FALSE(bad_message); |
| 67 ASSERT_FALSE(HasResponse()); | 67 ASSERT_FALSE(HasResponse()); |
| 68 response_.reset(new bool); | 68 response_.reset(new bool); |
| 69 *response_ = success; | 69 *response_ = success; |
| 70 if (should_post_quit_) { | 70 if (should_post_quit_) { |
| 71 base::MessageLoopForUI::current()->Quit(); | 71 base::MessageLoopForUI::current()->Quit(); |
| 72 } | 72 } |
| 73 } | 73 } |
| 74 | 74 |
| 75 private: | 75 private: |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 response_delegate.set_should_post_quit(true); | 196 response_delegate.set_should_post_quit(true); |
| 197 content::RunMessageLoop(); | 197 content::RunMessageLoop(); |
| 198 } | 198 } |
| 199 | 199 |
| 200 EXPECT_TRUE(response_delegate.HasResponse()); | 200 EXPECT_TRUE(response_delegate.HasResponse()); |
| 201 return response_delegate.GetResponse(); | 201 return response_delegate.GetResponse(); |
| 202 } | 202 } |
| 203 | 203 |
| 204 } // namespace api_test_utils | 204 } // namespace api_test_utils |
| 205 } // namespace extensions | 205 } // namespace extensions |
| OLD | NEW |