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

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

Issue 11369253: Fix crash when programatically closing media gallery dialog (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/cocoa/extensions/media_galleries_dialog_cocoa.h"
6
7 #include "chrome/browser/media_gallery/media_galleries_dialog_controller_mock.h"
8 #include "chrome/browser/ui/browser_tabstrip.h"
9 #include "chrome/browser/ui/constrained_window_tab_helper.h"
10 #include "chrome/test/base/in_process_browser_test.h"
11 #include "content/public/test/test_utils.h"
12 #include "testing/gtest/include/gtest/gtest.h"
13
14 using ::testing::NiceMock;
15 using ::testing::Return;
16 using ::testing::ReturnRef;
17
18 namespace chrome {
19
20 class MediaGalleriesDialogBrowserTest : public InProcessBrowserTest {
21 };
22
23 // Verify that programatically closing the constrained window correctly closes
24 // the sheet.
25 IN_PROC_BROWSER_TEST_F(MediaGalleriesDialogBrowserTest, Close) {
Avi (use Gerrit) 2012/11/14 21:17:41 Whoooooo!
26 NiceMock<MediaGalleriesDialogControllerMock> controller;
27
28 content::WebContents* web_contents = chrome::GetActiveWebContents(browser());
29 EXPECT_CALL(controller, web_contents()).
30 WillRepeatedly(Return(web_contents));
31
32 MediaGalleriesDialogController::KnownGalleryPermissions permissions;
33 EXPECT_CALL(controller, permissions()).
34 WillRepeatedly(ReturnRef(permissions));
35
36 scoped_ptr<MediaGalleriesDialogCocoa> dialog(
37 static_cast<MediaGalleriesDialogCocoa*>(
38 MediaGalleriesDialog::Create(&controller)));
39 scoped_nsobject<NSWindow> window([[dialog->alert_ window] retain]);
40 EXPECT_TRUE([window isVisible]);
41
42 ConstrainedWindowTabHelper* constrained_window_tab_helper =
43 ConstrainedWindowTabHelper::FromWebContents(web_contents);
44 constrained_window_tab_helper->CloseConstrainedWindows();
45 EXPECT_FALSE([window isVisible]);
46 }
47
48 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/extensions/media_galleries_dialog_cocoa.mm ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698