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

Side by Side Diff: chrome/browser/ui/cocoa/certificate_viewer_mac_browsertest.mm

Issue 23815006: [Cleanup] rename WebContentsModalDialogManager::IsShowingDialog() to IsDialogActive() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 3 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/certificate_viewer.h" 5 #import "chrome/browser/certificate_viewer.h"
6 6
7 #include "chrome/browser/ui/browser.h" 7 #include "chrome/browser/ui/browser.h"
8 #include "chrome/browser/ui/browser_commands.h" 8 #include "chrome/browser/ui/browser_commands.h"
9 #include "chrome/browser/ui/cocoa/certificate_viewer_mac.h" 9 #include "chrome/browser/ui/cocoa/certificate_viewer_mac.h"
10 #include "chrome/browser/ui/tabs/tab_strip_model.h" 10 #include "chrome/browser/ui/tabs/tab_strip_model.h"
(...skipping 19 matching lines...) Expand all
30 } // namespace 30 } // namespace
31 31
32 IN_PROC_BROWSER_TEST_F(SSLCertificateViewerCocoaTest, Basic) { 32 IN_PROC_BROWSER_TEST_F(SSLCertificateViewerCocoaTest, Basic) {
33 scoped_refptr<net::X509Certificate> cert = GetSampleCertificate(); 33 scoped_refptr<net::X509Certificate> cert = GetSampleCertificate();
34 ASSERT_TRUE(cert.get()); 34 ASSERT_TRUE(cert.get());
35 content::WebContents* web_contents = 35 content::WebContents* web_contents =
36 browser()->tab_strip_model()->GetActiveWebContents(); 36 browser()->tab_strip_model()->GetActiveWebContents();
37 gfx::NativeWindow window = web_contents->GetView()->GetTopLevelNativeWindow(); 37 gfx::NativeWindow window = web_contents->GetView()->GetTopLevelNativeWindow();
38 WebContentsModalDialogManager* web_contents_modal_dialog_manager = 38 WebContentsModalDialogManager* web_contents_modal_dialog_manager =
39 WebContentsModalDialogManager::FromWebContents(web_contents); 39 WebContentsModalDialogManager::FromWebContents(web_contents);
40 EXPECT_FALSE(web_contents_modal_dialog_manager->IsShowingDialog()); 40 EXPECT_FALSE(web_contents_modal_dialog_manager->IsDialogActive());
41 41
42 ShowCertificateViewer(web_contents, window, cert.get()); 42 ShowCertificateViewer(web_contents, window, cert.get());
43 43
44 content::RunAllPendingInMessageLoop(); 44 content::RunAllPendingInMessageLoop();
45 EXPECT_TRUE(web_contents_modal_dialog_manager->IsShowingDialog()); 45 EXPECT_TRUE(web_contents_modal_dialog_manager->IsDialogActive());
46 46
47 WebContentsModalDialogManager::TestApi test_api( 47 WebContentsModalDialogManager::TestApi test_api(
48 web_contents_modal_dialog_manager); 48 web_contents_modal_dialog_manager);
49 test_api.CloseAllDialogs(); 49 test_api.CloseAllDialogs();
50 content::RunAllPendingInMessageLoop(); 50 content::RunAllPendingInMessageLoop();
51 EXPECT_FALSE(web_contents_modal_dialog_manager->IsShowingDialog()); 51 EXPECT_FALSE(web_contents_modal_dialog_manager->IsDialogActive());
52 } 52 }
53 53
54 // Test that switching to another tab correctly hides the sheet. 54 // Test that switching to another tab correctly hides the sheet.
55 IN_PROC_BROWSER_TEST_F(SSLCertificateViewerCocoaTest, HideShow) { 55 IN_PROC_BROWSER_TEST_F(SSLCertificateViewerCocoaTest, HideShow) {
56 scoped_refptr<net::X509Certificate> cert = GetSampleCertificate(); 56 scoped_refptr<net::X509Certificate> cert = GetSampleCertificate();
57 ASSERT_TRUE(cert.get()); 57 ASSERT_TRUE(cert.get());
58 content::WebContents* web_contents = 58 content::WebContents* web_contents =
59 browser()->tab_strip_model()->GetActiveWebContents(); 59 browser()->tab_strip_model()->GetActiveWebContents();
60 60
61 SSLCertificateViewerCocoa* viewer = 61 SSLCertificateViewerCocoa* viewer =
(...skipping 10 matching lines...) Expand all
72 AddBlankTabAndShow(browser()); 72 AddBlankTabAndShow(browser());
73 EXPECT_EQ(0.0, [sheetWindow alphaValue]); 73 EXPECT_EQ(0.0, [sheetWindow alphaValue]);
74 EXPECT_TRUE( 74 EXPECT_TRUE(
75 NSEqualRects(ui::kWindowSizeDeterminedLater, [sheetWindow frame])); 75 NSEqualRects(ui::kWindowSizeDeterminedLater, [sheetWindow frame]));
76 76
77 // Switch back and verify that the sheet is shown. 77 // Switch back and verify that the sheet is shown.
78 chrome::SelectNumberedTab(browser(), 0); 78 chrome::SelectNumberedTab(browser(), 0);
79 EXPECT_EQ(1.0, [sheetWindow alphaValue]); 79 EXPECT_EQ(1.0, [sheetWindow alphaValue]);
80 EXPECT_TRUE(NSEqualRects(sheetFrame, [sheetWindow frame])); 80 EXPECT_TRUE(NSEqualRects(sheetFrame, [sheetWindow frame]));
81 } 81 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698