OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #import "chrome/browser/ui/cocoa/extensions/windowed_install_dialog_controller.h
" | 5 #import "chrome/browser/ui/cocoa/extensions/windowed_install_dialog_controller.h
" |
6 | 6 |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "base/threading/sequenced_worker_pool.h" | 8 #include "base/threading/sequenced_worker_pool.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #import "chrome/browser/ui/cocoa/extensions/extension_install_prompt_test_utils.
h" | 10 #import "chrome/browser/ui/cocoa/extensions/extension_install_prompt_test_utils.
h" |
11 #import "chrome/browser/ui/cocoa/extensions/extension_install_view_controller.h" | 11 #import "chrome/browser/ui/cocoa/extensions/extension_install_view_controller.h" |
12 #include "chrome/test/base/in_process_browser_test.h" | 12 #include "chrome/test/base/in_process_browser_test.h" |
13 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
14 #include "extensions/common/extension.h" | 14 #include "extensions/common/extension.h" |
15 | 15 |
16 namespace { | 16 namespace { |
17 | 17 |
18 // Similar to ShowExtensionInstallDialogImpl except this allows the created | 18 // Similar to ShowExtensionInstallDialogImpl except this allows the created |
19 // dialog controller to be captured and manipulated for tests. | 19 // dialog controller to be captured and manipulated for tests. |
20 void TestingShowAppListInstallDialogController( | 20 void TestingShowAppListInstallDialogController( |
21 WindowedInstallDialogController** controller, | 21 WindowedInstallDialogController** controller, |
22 const ExtensionInstallPrompt::ShowParams& show_params, | 22 const ExtensionInstallPrompt::ShowParams& show_params, |
23 ExtensionInstallPrompt::Delegate* delegate, | 23 ExtensionInstallPrompt::Delegate* delegate, |
24 const ExtensionInstallPrompt::Prompt& prompt) { | 24 scoped_refptr<ExtensionInstallPrompt::Prompt> prompt) { |
25 *controller = | 25 *controller = |
26 new WindowedInstallDialogController(show_params, delegate, prompt); | 26 new WindowedInstallDialogController(show_params, delegate, prompt); |
27 } | 27 } |
28 | 28 |
29 typedef InProcessBrowserTest WindowedInstallDialogControllerBrowserTest; | 29 typedef InProcessBrowserTest WindowedInstallDialogControllerBrowserTest; |
30 | 30 |
31 } // namespace | 31 } // namespace |
32 | 32 |
33 // Test for showing an extension install prompt with no parent WebContents. | 33 // Test for showing an extension install prompt with no parent WebContents. |
34 IN_PROC_BROWSER_TEST_F(WindowedInstallDialogControllerBrowserTest, | 34 IN_PROC_BROWSER_TEST_F(WindowedInstallDialogControllerBrowserTest, |
(...skipping 24 matching lines...) Expand all Loading... |
59 EXPECT_EQ(0, delegate.abort_count()); | 59 EXPECT_EQ(0, delegate.abort_count()); |
60 | 60 |
61 // Press cancel to close the window. | 61 // Press cancel to close the window. |
62 [[controller->GetViewController() cancelButton] performClick:nil]; | 62 [[controller->GetViewController() cancelButton] performClick:nil]; |
63 EXPECT_FALSE([window delegate]); | 63 EXPECT_FALSE([window delegate]); |
64 EXPECT_EQ(1, delegate.abort_count()); | 64 EXPECT_EQ(1, delegate.abort_count()); |
65 | 65 |
66 // Ensure the window is closed. | 66 // Ensure the window is closed. |
67 EXPECT_FALSE([window isVisible]); | 67 EXPECT_FALSE([window isVisible]); |
68 } | 68 } |
OLD | NEW |