| 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 <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 : public UIThreadExtensionFunction::DelegateForTests { | 37 : public UIThreadExtensionFunction::DelegateForTests { |
| 38 public: | 38 public: |
| 39 SendResponseDelegate() {} | 39 SendResponseDelegate() {} |
| 40 | 40 |
| 41 virtual ~SendResponseDelegate() {} | 41 virtual ~SendResponseDelegate() {} |
| 42 | 42 |
| 43 bool HasResponse() { return response_.get() != NULL; } | 43 bool HasResponse() { return response_.get() != NULL; } |
| 44 | 44 |
| 45 bool GetResponse() { | 45 bool GetResponse() { |
| 46 EXPECT_TRUE(HasResponse()); | 46 EXPECT_TRUE(HasResponse()); |
| 47 return *response_.get(); | 47 return *response_; |
| 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 run_loop_.Quit(); | 57 run_loop_.Quit(); |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 function->set_include_incognito(flags & INCLUDE_INCOGNITO); | 251 function->set_include_incognito(flags & INCLUDE_INCOGNITO); |
| 252 function->RunWithValidation()->Execute(); | 252 function->RunWithValidation()->Execute(); |
| 253 response_delegate.WaitForResponse(); | 253 response_delegate.WaitForResponse(); |
| 254 | 254 |
| 255 EXPECT_TRUE(response_delegate.HasResponse()); | 255 EXPECT_TRUE(response_delegate.HasResponse()); |
| 256 return response_delegate.GetResponse(); | 256 return response_delegate.GetResponse(); |
| 257 } | 257 } |
| 258 | 258 |
| 259 } // namespace api_test_utils | 259 } // namespace api_test_utils |
| 260 } // namespace extensions | 260 } // namespace extensions |
| OLD | NEW |