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

Unified Diff: chrome/browser/ui/cocoa/constrained_window/constrained_window_mac_browsertest.mm

Issue 1430023002: Enable AutoResize for Constrained Web Dialogs for Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes per erikchen@'s comments. Created 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/constrained_window/constrained_window_mac_browsertest.mm
diff --git a/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac_browsertest.mm b/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac_browsertest.mm
index 5456a25e9436ba03c9852fa496a5d50ed6e0a273..f5712aadb2c191cd386f07541a7c184b0fcb8cfb 100644
--- a/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac_browsertest.mm
+++ b/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac_browsertest.mm
@@ -77,14 +77,15 @@ class ConstrainedWindowMacTest : public InProcessBrowserTest {
IN_PROC_BROWSER_TEST_F(ConstrainedWindowMacTest, ShowInInactiveTab) {
// Show dialog in non active tab.
NiceMock<ConstrainedWindowDelegateMock> delegate;
- ConstrainedWindowMac dialog(&delegate, tab0_, sheet_);
+ ConstrainedWindowMac* dialog =
+ CreateAndShowWebModalDialogMac(&delegate, tab0_, sheet_);
EXPECT_EQ(0.0, [sheet_window_ alphaValue]);
// Switch to inactive tab.
browser()->tab_strip_model()->ActivateTabAt(0, true);
EXPECT_EQ(1.0, [sheet_window_ alphaValue]);
- dialog.CloseWebContentsModalDialog();
+ dialog->CloseWebContentsModalDialog();
}
// If a tab has never been shown then the associated tab view for the web
@@ -103,7 +104,8 @@ IN_PROC_BROWSER_TEST_F(ConstrainedWindowMacTest, ShowInUninitializedTab) {
// Show dialog and verify that it's not visible yet.
NiceMock<ConstrainedWindowDelegateMock> delegate;
- ConstrainedWindowMac dialog(&delegate, tab2, sheet_);
+ ConstrainedWindowMac* dialog =
+ CreateAndShowWebModalDialogMac(&delegate, tab2, sheet_);
EXPECT_FALSE([sheet_window_ isVisible]);
// Activate the tab and verify that the constrained window is shown.
@@ -112,25 +114,26 @@ IN_PROC_BROWSER_TEST_F(ConstrainedWindowMacTest, ShowInUninitializedTab) {
EXPECT_TRUE([sheet_window_ isVisible]);
EXPECT_EQ(1.0, [sheet_window_ alphaValue]);
- dialog.CloseWebContentsModalDialog();
+ dialog->CloseWebContentsModalDialog();
}
// Test that adding a sheet disables tab dragging.
IN_PROC_BROWSER_TEST_F(ConstrainedWindowMacTest, TabDragging) {
NiceMock<ConstrainedWindowDelegateMock> delegate;
- ConstrainedWindowMac dialog(&delegate, tab1_, sheet_);
+ ConstrainedWindowMac* dialog =
+ CreateAndShowWebModalDialogMac(&delegate, tab1_, sheet_);
// Verify that the dialog disables dragging.
EXPECT_TRUE([controller_ isTabDraggable:tab_view0_]);
EXPECT_FALSE([controller_ isTabDraggable:tab_view1_]);
- dialog.CloseWebContentsModalDialog();
+ dialog->CloseWebContentsModalDialog();
}
// Test that closing a browser window with a sheet works.
IN_PROC_BROWSER_TEST_F(ConstrainedWindowMacTest, BrowserWindowClose) {
NiceMock<ConstrainedWindowDelegateMock> delegate;
- ConstrainedWindowMac dialog(&delegate, tab1_, sheet_);
+ CreateAndShowWebModalDialogMac(&delegate, tab1_, sheet_);
EXPECT_EQ(1.0, [sheet_window_ alphaValue]);
// Close the browser window.
@@ -144,7 +147,7 @@ IN_PROC_BROWSER_TEST_F(ConstrainedWindowMacTest, BrowserWindowClose) {
// Test that closing a tab with a sheet works.
IN_PROC_BROWSER_TEST_F(ConstrainedWindowMacTest, TabClose) {
NiceMock<ConstrainedWindowDelegateMock> delegate;
- ConstrainedWindowMac dialog(&delegate, tab1_, sheet_);
+ CreateAndShowWebModalDialogMac(&delegate, tab1_, sheet_);
EXPECT_EQ(1.0, [sheet_window_ alphaValue]);
// Close the tab.

Powered by Google App Engine
This is Rietveld 408576698