OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/ui/cocoa/extensions/media_galleries_dialog_cocoa.h" | 5 #include "chrome/browser/ui/cocoa/extensions/media_galleries_dialog_cocoa.h" |
6 | 6 |
7 #include "chrome/browser/media_galleries/media_galleries_dialog_controller_mock.
h" | 7 #include "chrome/browser/media_galleries/media_galleries_dialog_controller_mock.
h" |
8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
9 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_alert.h" | 9 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_alert.h" |
10 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
11 #include "chrome/common/extensions/extension.h" | 11 #include "chrome/common/extensions/extension.h" |
12 #include "chrome/common/extensions/extension_test_util.h" | 12 #include "chrome/common/extensions/extension_test_util.h" |
13 #include "chrome/test/base/in_process_browser_test.h" | 13 #include "chrome/test/base/in_process_browser_test.h" |
14 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 14 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
15 #include "content/public/test/test_utils.h" | 15 #include "content/public/test/test_utils.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 | 17 |
18 using ::testing::NiceMock; | 18 using ::testing::NiceMock; |
19 using ::testing::Return; | 19 using ::testing::Return; |
20 using ::testing::ReturnRef; | 20 using ::testing::ReturnRef; |
21 using web_modal::WebContentsModalDialogManager; | 21 using web_modal::WebContentsModalDialogManager; |
22 | 22 |
23 namespace chrome { | |
24 | |
25 class MediaGalleriesDialogBrowserTest : public InProcessBrowserTest { | 23 class MediaGalleriesDialogBrowserTest : public InProcessBrowserTest { |
26 }; | 24 }; |
27 | 25 |
28 // Verify that programatically closing the constrained window correctly closes | 26 // Verify that programatically closing the constrained window correctly closes |
29 // the sheet. | 27 // the sheet. |
30 IN_PROC_BROWSER_TEST_F(MediaGalleriesDialogBrowserTest, Close) { | 28 IN_PROC_BROWSER_TEST_F(MediaGalleriesDialogBrowserTest, Close) { |
31 scoped_refptr<extensions::Extension> dummy_extension = | 29 scoped_refptr<extensions::Extension> dummy_extension = |
32 extension_test_util::CreateExtensionWithID("dummy"); | 30 extension_test_util::CreateExtensionWithID("dummy"); |
33 NiceMock<MediaGalleriesDialogControllerMock> controller(*dummy_extension); | 31 NiceMock<MediaGalleriesDialogControllerMock> controller(*dummy_extension); |
34 | 32 |
(...skipping 16 matching lines...) Expand all Loading... |
51 base::scoped_nsobject<NSWindow> window([[dialog->alert_ window] retain]); | 49 base::scoped_nsobject<NSWindow> window([[dialog->alert_ window] retain]); |
52 EXPECT_TRUE([window isVisible]); | 50 EXPECT_TRUE([window isVisible]); |
53 | 51 |
54 WebContentsModalDialogManager* web_contents_modal_dialog_manager = | 52 WebContentsModalDialogManager* web_contents_modal_dialog_manager = |
55 WebContentsModalDialogManager::FromWebContents(web_contents); | 53 WebContentsModalDialogManager::FromWebContents(web_contents); |
56 WebContentsModalDialogManager::TestApi test_api( | 54 WebContentsModalDialogManager::TestApi test_api( |
57 web_contents_modal_dialog_manager); | 55 web_contents_modal_dialog_manager); |
58 test_api.CloseAllDialogs(); | 56 test_api.CloseAllDialogs(); |
59 EXPECT_FALSE([window isVisible]); | 57 EXPECT_FALSE([window isVisible]); |
60 } | 58 } |
61 | |
62 } // namespace chrome | |
OLD | NEW |