| 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 "base/macros.h" | 5 #include "base/macros.h" |
| 6 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
| 7 #include "chrome/browser/extensions/extension_install_prompt.h" | 7 #include "chrome/browser/extensions/extension_install_prompt.h" |
| 8 #include "chrome/browser/extensions/extension_reenabler.h" | 8 #include "chrome/browser/extensions/extension_reenabler.h" |
| 9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/extensions/extension_service_test_base.h" | 10 #include "chrome/browser/extensions/extension_service_test_base.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 } | 73 } |
| 74 | 74 |
| 75 private: | 75 private: |
| 76 // The callback to run once the reenable process finishes. | 76 // The callback to run once the reenable process finishes. |
| 77 void OnComplete(ExtensionReenabler::ReenableResult result) { | 77 void OnComplete(ExtensionReenabler::ReenableResult result) { |
| 78 result_.reset(new ExtensionReenabler::ReenableResult(result)); | 78 result_.reset(new ExtensionReenabler::ReenableResult(result)); |
| 79 } | 79 } |
| 80 | 80 |
| 81 // The callback to run when a test ExtensionInstallPrompt is ready to show. | 81 // The callback to run when a test ExtensionInstallPrompt is ready to show. |
| 82 void OnShow(ExtensionInstallPromptShowParams* show_params, | 82 void OnShow(ExtensionInstallPromptShowParams* show_params, |
| 83 ExtensionInstallPrompt::Delegate* delegate, | 83 const ExtensionInstallPrompt::DoneCallback& done_callback, |
| 84 scoped_ptr<ExtensionInstallPrompt::Prompt> prompt) { | 84 scoped_ptr<ExtensionInstallPrompt::Prompt> prompt) { |
| 85 DCHECK(!quit_closure_.is_null()); | 85 DCHECK(!quit_closure_.is_null()); |
| 86 quit_closure_.Run(); | 86 quit_closure_.Run(); |
| 87 quit_closure_ = base::Closure(); | 87 quit_closure_ = base::Closure(); |
| 88 } | 88 } |
| 89 | 89 |
| 90 // The closure to quit the currently-running loop; used with test | 90 // The closure to quit the currently-running loop; used with test |
| 91 // ExtensionInstallPrompts. | 91 // ExtensionInstallPrompts. |
| 92 base::Closure quit_closure_; | 92 base::Closure quit_closure_; |
| 93 | 93 |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 EXPECT_FALSE(callback_helper.has_result()); | 261 EXPECT_FALSE(callback_helper.has_result()); |
| 262 // Destroy the reenabler to simulate the owning context being shut down | 262 // Destroy the reenabler to simulate the owning context being shut down |
| 263 // (e.g., the tab closing). | 263 // (e.g., the tab closing). |
| 264 extension_reenabler.reset(); | 264 extension_reenabler.reset(); |
| 265 EXPECT_TRUE( | 265 EXPECT_TRUE( |
| 266 callback_helper.result_matches(ExtensionReenabler::ABORTED)); | 266 callback_helper.result_matches(ExtensionReenabler::ABORTED)); |
| 267 } | 267 } |
| 268 } | 268 } |
| 269 | 269 |
| 270 } // namespace extensions | 270 } // namespace extensions |
| OLD | NEW |