Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Side by Side Diff: chrome/browser/ui/cocoa/extensions/media_galleries_dialog_cocoa_browsertest.mm

Issue 110463003: Create extensions_test_support build target (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase extension_test_util Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/extensions/media_galleries_dialog_cocoa_unittest.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_test_util.h"
12 #include "chrome/test/base/in_process_browser_test.h" 11 #include "chrome/test/base/in_process_browser_test.h"
13 #include "components/web_modal/web_contents_modal_dialog_manager.h" 12 #include "components/web_modal/web_contents_modal_dialog_manager.h"
14 #include "content/public/test/test_utils.h" 13 #include "content/public/test/test_utils.h"
15 #include "extensions/common/extension.h" 14 #include "extensions/common/extension.h"
15 #include "extensions/common/test_util.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 class MediaGalleriesDialogBrowserTest : public InProcessBrowserTest { 23 class MediaGalleriesDialogBrowserTest : public InProcessBrowserTest {
24 }; 24 };
25 25
26 // Verify that programatically closing the constrained window correctly closes 26 // Verify that programatically closing the constrained window correctly closes
27 // the sheet. 27 // the sheet.
28 IN_PROC_BROWSER_TEST_F(MediaGalleriesDialogBrowserTest, Close) { 28 IN_PROC_BROWSER_TEST_F(MediaGalleriesDialogBrowserTest, Close) {
29 scoped_refptr<extensions::Extension> dummy_extension = 29 scoped_refptr<extensions::Extension> dummy_extension =
30 extension_test_util::CreateExtensionWithID("dummy"); 30 extensions::test_util::CreateExtensionWithID("dummy");
31 NiceMock<MediaGalleriesDialogControllerMock> controller(*dummy_extension); 31 NiceMock<MediaGalleriesDialogControllerMock> controller(*dummy_extension);
32 32
33 content::WebContents* web_contents = 33 content::WebContents* web_contents =
34 browser()->tab_strip_model()->GetActiveWebContents(); 34 browser()->tab_strip_model()->GetActiveWebContents();
35 EXPECT_CALL(controller, web_contents()). 35 EXPECT_CALL(controller, web_contents()).
36 WillRepeatedly(Return(web_contents)); 36 WillRepeatedly(Return(web_contents));
37 37
38 MediaGalleriesDialogController::GalleryPermissionsVector attached_permissions; 38 MediaGalleriesDialogController::GalleryPermissionsVector attached_permissions;
39 EXPECT_CALL(controller, AttachedPermissions()). 39 EXPECT_CALL(controller, AttachedPermissions()).
40 WillRepeatedly(Return(attached_permissions)); 40 WillRepeatedly(Return(attached_permissions));
41 MediaGalleriesDialogController::GalleryPermissionsVector 41 MediaGalleriesDialogController::GalleryPermissionsVector
42 unattached_permissions; 42 unattached_permissions;
43 EXPECT_CALL(controller, UnattachedPermissions()). 43 EXPECT_CALL(controller, UnattachedPermissions()).
44 WillRepeatedly(Return(unattached_permissions)); 44 WillRepeatedly(Return(unattached_permissions));
45 45
46 scoped_ptr<MediaGalleriesDialogCocoa> dialog( 46 scoped_ptr<MediaGalleriesDialogCocoa> dialog(
47 static_cast<MediaGalleriesDialogCocoa*>( 47 static_cast<MediaGalleriesDialogCocoa*>(
48 MediaGalleriesDialog::Create(&controller))); 48 MediaGalleriesDialog::Create(&controller)));
49 base::scoped_nsobject<NSWindow> window([[dialog->alert_ window] retain]); 49 base::scoped_nsobject<NSWindow> window([[dialog->alert_ window] retain]);
50 EXPECT_TRUE([window isVisible]); 50 EXPECT_TRUE([window isVisible]);
51 51
52 WebContentsModalDialogManager* web_contents_modal_dialog_manager = 52 WebContentsModalDialogManager* web_contents_modal_dialog_manager =
53 WebContentsModalDialogManager::FromWebContents(web_contents); 53 WebContentsModalDialogManager::FromWebContents(web_contents);
54 WebContentsModalDialogManager::TestApi test_api( 54 WebContentsModalDialogManager::TestApi test_api(
55 web_contents_modal_dialog_manager); 55 web_contents_modal_dialog_manager);
56 test_api.CloseAllDialogs(); 56 test_api.CloseAllDialogs();
57 EXPECT_FALSE([window isVisible]); 57 EXPECT_FALSE([window isVisible]);
58 } 58 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/extensions/media_galleries_dialog_cocoa_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698