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

Side by Side Diff: chrome/browser/ui/views/web_dialog_view_browsertest.cc

Issue 490123002: Revert of MacViews: Fix WebDialogBrowserTest.SizeWindow to get browser_tests compiling on MacViews (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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/chrome_tests.gypi » ('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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 DISALLOW_COPY_AND_ASSIGN(TestWebDialogView); 77 DISALLOW_COPY_AND_ASSIGN(TestWebDialogView);
78 }; 78 };
79 79
80 } // namespace 80 } // namespace
81 81
82 class WebDialogBrowserTest : public InProcessBrowserTest { 82 class WebDialogBrowserTest : public InProcessBrowserTest {
83 public: 83 public:
84 WebDialogBrowserTest() {} 84 WebDialogBrowserTest() {}
85 }; 85 };
86 86
87 // Windows has some issues resizing windows. An off by one problem, and a 87 // http://code.google.com/p/chromium/issues/detail?id=52602
88 // minimum size that seems too big. See http://crbug.com/52602. 88 // Windows has some issues resizing windows- an off by one problem,
89 #if defined(OS_WIN) 89 // and a minimum size that seems too big. This file isn't included in
90 #define MAYBE_SizeWindow DISABLED_SizeWindow 90 // Mac builds yet. On Chrome OS, this test doesn't apply since ChromeOS
91 #else 91 // doesn't allow resizing of windows.
92 #define MAYBE_SizeWindow SizeWindow 92 IN_PROC_BROWSER_TEST_F(WebDialogBrowserTest, DISABLED_SizeWindow) {
93 #endif
94 IN_PROC_BROWSER_TEST_F(WebDialogBrowserTest, MAYBE_SizeWindow) {
95 ui::test::TestWebDialogDelegate* delegate = 93 ui::test::TestWebDialogDelegate* delegate =
96 new ui::test::TestWebDialogDelegate( 94 new ui::test::TestWebDialogDelegate(
97 GURL(chrome::kChromeUIChromeURLsURL)); 95 GURL(chrome::kChromeUIChromeURLsURL));
98 delegate->set_size(kInitialWidth, kInitialHeight); 96 delegate->set_size(kInitialWidth, kInitialHeight);
99 97
100 TestWebDialogView* view = 98 TestWebDialogView* view =
101 new TestWebDialogView(browser()->profile(), delegate); 99 new TestWebDialogView(browser()->profile(), delegate);
102 WebContents* web_contents = 100 WebContents* web_contents =
103 browser()->tab_strip_model()->GetActiveWebContents(); 101 browser()->tab_strip_model()->GetActiveWebContents();
104 ASSERT_TRUE(web_contents != NULL); 102 ASSERT_TRUE(web_contents != NULL);
105 views::Widget::CreateWindowWithParent(view, web_contents->GetNativeView()); 103 views::Widget::CreateWindowWithParent(
104 view, web_contents->GetTopLevelNativeWindow());
106 view->GetWidget()->Show(); 105 view->GetWidget()->Show();
107 106
108 // TestWebDialogView should quit current message loop on size change. 107 // TestWebDialogView should quit current message loop on size change.
109 view->set_should_quit_on_size_change(true); 108 view->set_should_quit_on_size_change(true);
110 109
111 gfx::Rect bounds = view->GetWidget()->GetClientAreaBoundsInScreen(); 110 gfx::Rect bounds = view->GetWidget()->GetClientAreaBoundsInScreen();
112 111
113 gfx::Rect set_bounds = bounds; 112 gfx::Rect set_bounds = bounds;
114 gfx::Rect actual_bounds, rwhv_bounds; 113 gfx::Rect actual_bounds, rwhv_bounds;
115 114
(...skipping 23 matching lines...) Expand all
139 EXPECT_EQ(set_bounds, actual_bounds); 138 EXPECT_EQ(set_bounds, actual_bounds);
140 139
141 rwhv_bounds = 140 rwhv_bounds =
142 view->web_contents()->GetRenderWidgetHostView()->GetViewBounds(); 141 view->web_contents()->GetRenderWidgetHostView()->GetViewBounds();
143 EXPECT_LT(0, rwhv_bounds.width()); 142 EXPECT_LT(0, rwhv_bounds.width());
144 EXPECT_LT(0, rwhv_bounds.height()); 143 EXPECT_LT(0, rwhv_bounds.height());
145 EXPECT_GE(set_bounds.width(), rwhv_bounds.width()); 144 EXPECT_GE(set_bounds.width(), rwhv_bounds.width());
146 EXPECT_GE(set_bounds.height(), rwhv_bounds.height()); 145 EXPECT_GE(set_bounds.height(), rwhv_bounds.height());
147 146
148 // Get very small. 147 // Get very small.
149 const gfx::Size min_size = view->GetWidget()->GetMinimumSize(); 148 gfx::Size min_size = view->GetWidget()->GetMinimumSize();
150 EXPECT_LT(0, min_size.width());
151 EXPECT_LT(0, min_size.height());
152
153 set_bounds.set_size(min_size); 149 set_bounds.set_size(min_size);
154 150
155 view->MoveContents(web_contents, set_bounds); 151 view->MoveContents(web_contents, set_bounds);
156 content::RunMessageLoop(); // TestWebDialogView will quit. 152 content::RunMessageLoop(); // TestWebDialogView will quit.
157 actual_bounds = view->GetWidget()->GetClientAreaBoundsInScreen(); 153 actual_bounds = view->GetWidget()->GetClientAreaBoundsInScreen();
158 EXPECT_EQ(set_bounds, actual_bounds); 154 EXPECT_EQ(set_bounds, actual_bounds);
159 155
160 rwhv_bounds = 156 rwhv_bounds =
161 view->web_contents()->GetRenderWidgetHostView()->GetViewBounds(); 157 view->web_contents()->GetRenderWidgetHostView()->GetViewBounds();
162 EXPECT_LT(0, rwhv_bounds.width()); 158 EXPECT_LT(0, rwhv_bounds.width());
163 EXPECT_LT(0, rwhv_bounds.height()); 159 EXPECT_LT(0, rwhv_bounds.height());
164 EXPECT_GE(set_bounds.width(), rwhv_bounds.width()); 160 EXPECT_GE(set_bounds.width(), rwhv_bounds.width());
165 EXPECT_GE(set_bounds.height(), rwhv_bounds.height()); 161 EXPECT_GE(set_bounds.height(), rwhv_bounds.height());
166 162
167 // Check to make sure we can't get to 0x0. First expand beyond the minimum 163 // Check to make sure we can't get to 0x0
168 // size that was set above so that TestWebDialogView has a change to pick up.
169 set_bounds.set_height(250);
170 view->MoveContents(web_contents, set_bounds);
171 content::RunMessageLoop(); // TestWebDialogView will quit.
172 actual_bounds = view->GetWidget()->GetClientAreaBoundsInScreen();
173 EXPECT_EQ(set_bounds, actual_bounds);
174
175 // Now verify that attempts to re-size to 0x0 enforces the minimum size.
176 set_bounds.set_width(0); 164 set_bounds.set_width(0);
177 set_bounds.set_height(0); 165 set_bounds.set_height(0);
178 166
179 view->MoveContents(web_contents, set_bounds); 167 view->MoveContents(web_contents, set_bounds);
180 content::RunMessageLoop(); // TestWebDialogView will quit. 168 content::RunMessageLoop(); // TestWebDialogView will quit.
181 actual_bounds = view->GetWidget()->GetClientAreaBoundsInScreen(); 169 actual_bounds = view->GetWidget()->GetClientAreaBoundsInScreen();
182 EXPECT_EQ(min_size, actual_bounds.size()); 170 EXPECT_LT(0, actual_bounds.width());
183 171 EXPECT_LT(0, actual_bounds.height());
184 // And that the render view is also non-zero.
185 rwhv_bounds =
186 view->web_contents()->GetRenderWidgetHostView()->GetViewBounds();
187 EXPECT_LT(0, rwhv_bounds.width());
188 EXPECT_LT(0, rwhv_bounds.height());
189 } 172 }
OLDNEW
« no previous file with comments | « no previous file | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698