Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 // http://code.google.com/p/chromium/issues/detail?id=52602 | 87 // Windows has some issues resizing windows. An off by one problem, and a |
| 88 // Windows has some issues resizing windows- an off by one problem, | 88 // minimum size that seems too big. See http://crbug.com/52602. On Chrome OS, |
| 89 // and a minimum size that seems too big. This file isn't included in | 89 // this test doesn't apply since ChromeOS doesn't allow resizing of windows. |
| 90 // Mac builds yet. On Chrome OS, this test doesn't apply since ChromeOS | 90 #if defined(OS_WIN) || defined(OS_CHROMEOS) |
|
tapted
2014/08/19 13:17:57
There are some bot runs in crrev.com/487143002. As
msw
2014/08/19 18:56:36
Go ahead and enable on CrOS, that comment is surel
tapted
2014/08/20 11:32:23
Done.
| |
| 91 // doesn't allow resizing of windows. | 91 #define MAYBE_SizeWindow DISABLED_SizeWindow |
| 92 IN_PROC_BROWSER_TEST_F(WebDialogBrowserTest, DISABLED_SizeWindow) { | 92 #else |
| 93 #define MAYBE_SizeWindow SizeWindow | |
| 94 #endif | |
| 95 IN_PROC_BROWSER_TEST_F(WebDialogBrowserTest, MAYBE_SizeWindow) { | |
| 93 ui::test::TestWebDialogDelegate* delegate = | 96 ui::test::TestWebDialogDelegate* delegate = |
| 94 new ui::test::TestWebDialogDelegate( | 97 new ui::test::TestWebDialogDelegate( |
| 95 GURL(chrome::kChromeUIChromeURLsURL)); | 98 GURL(chrome::kChromeUIChromeURLsURL)); |
| 96 delegate->set_size(kInitialWidth, kInitialHeight); | 99 delegate->set_size(kInitialWidth, kInitialHeight); |
| 97 | 100 |
| 98 TestWebDialogView* view = | 101 TestWebDialogView* view = |
| 99 new TestWebDialogView(browser()->profile(), delegate); | 102 new TestWebDialogView(browser()->profile(), delegate); |
| 100 WebContents* web_contents = | 103 WebContents* web_contents = |
| 101 browser()->tab_strip_model()->GetActiveWebContents(); | 104 browser()->tab_strip_model()->GetActiveWebContents(); |
| 102 ASSERT_TRUE(web_contents != NULL); | 105 ASSERT_TRUE(web_contents != NULL); |
| 103 views::Widget::CreateWindowWithParent( | 106 views::Widget::CreateWindowWithParent(view, web_contents->GetNativeView()); |
| 104 view, web_contents->GetTopLevelNativeWindow()); | |
| 105 view->GetWidget()->Show(); | 107 view->GetWidget()->Show(); |
| 106 | 108 |
| 107 // TestWebDialogView should quit current message loop on size change. | 109 // TestWebDialogView should quit current message loop on size change. |
| 108 view->set_should_quit_on_size_change(true); | 110 view->set_should_quit_on_size_change(true); |
| 109 | 111 |
| 110 gfx::Rect bounds = view->GetWidget()->GetClientAreaBoundsInScreen(); | 112 gfx::Rect bounds = view->GetWidget()->GetClientAreaBoundsInScreen(); |
| 111 | 113 |
| 112 gfx::Rect set_bounds = bounds; | 114 gfx::Rect set_bounds = bounds; |
| 113 gfx::Rect actual_bounds, rwhv_bounds; | 115 gfx::Rect actual_bounds, rwhv_bounds; |
| 114 | 116 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 153 actual_bounds = view->GetWidget()->GetClientAreaBoundsInScreen(); | 155 actual_bounds = view->GetWidget()->GetClientAreaBoundsInScreen(); |
| 154 EXPECT_EQ(set_bounds, actual_bounds); | 156 EXPECT_EQ(set_bounds, actual_bounds); |
| 155 | 157 |
| 156 rwhv_bounds = | 158 rwhv_bounds = |
| 157 view->web_contents()->GetRenderWidgetHostView()->GetViewBounds(); | 159 view->web_contents()->GetRenderWidgetHostView()->GetViewBounds(); |
| 158 EXPECT_LT(0, rwhv_bounds.width()); | 160 EXPECT_LT(0, rwhv_bounds.width()); |
| 159 EXPECT_LT(0, rwhv_bounds.height()); | 161 EXPECT_LT(0, rwhv_bounds.height()); |
| 160 EXPECT_GE(set_bounds.width(), rwhv_bounds.width()); | 162 EXPECT_GE(set_bounds.width(), rwhv_bounds.width()); |
| 161 EXPECT_GE(set_bounds.height(), rwhv_bounds.height()); | 163 EXPECT_GE(set_bounds.height(), rwhv_bounds.height()); |
| 162 | 164 |
| 163 // Check to make sure we can't get to 0x0 | 165 // Check to make sure we can't get to 0x0. First make it larger than the |
| 166 // minimum size to ensure there's something to change. | |
|
msw
2014/08/19 18:56:36
Is this verifying that re-sizing to 0x0 enforces t
tapted
2014/08/20 11:32:23
Yes - the old code was doing that below, but it wa
| |
| 167 set_bounds.set_height(250); | |
| 168 view->MoveContents(web_contents, set_bounds); | |
| 169 content::RunMessageLoop(); // TestWebDialogView will quit. | |
| 170 | |
| 164 set_bounds.set_width(0); | 171 set_bounds.set_width(0); |
| 165 set_bounds.set_height(0); | 172 set_bounds.set_height(0); |
| 166 | 173 |
| 167 view->MoveContents(web_contents, set_bounds); | 174 view->MoveContents(web_contents, set_bounds); |
| 168 content::RunMessageLoop(); // TestWebDialogView will quit. | 175 content::RunMessageLoop(); // TestWebDialogView will quit. |
| 169 actual_bounds = view->GetWidget()->GetClientAreaBoundsInScreen(); | 176 actual_bounds = view->GetWidget()->GetClientAreaBoundsInScreen(); |
| 170 EXPECT_LT(0, actual_bounds.width()); | 177 EXPECT_LT(0, actual_bounds.width()); |
| 171 EXPECT_LT(0, actual_bounds.height()); | 178 EXPECT_LT(0, actual_bounds.height()); |
| 172 } | 179 } |
| OLD | NEW |