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

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

Issue 10204002: Revert 133467 - Convert the last users of DOMView to WebView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 8 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) 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/file_path.h" 7 #include "base/file_path.h"
8 #include "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 test::TestHtmlDialogUIDelegate* delegate = new test::TestHtmlDialogUIDelegate( 107 test::TestHtmlDialogUIDelegate* delegate = new test::TestHtmlDialogUIDelegate(
108 GURL(chrome::kChromeUIChromeURLsURL)); 108 GURL(chrome::kChromeUIChromeURLsURL));
109 delegate->set_size(kInitialWidth, kInitialHeight); 109 delegate->set_size(kInitialWidth, kInitialHeight);
110 110
111 TestHtmlDialogView* html_view = 111 TestHtmlDialogView* html_view =
112 new TestHtmlDialogView(browser()->profile(), browser(), delegate); 112 new TestHtmlDialogView(browser()->profile(), browser(), delegate);
113 WebContents* web_contents = browser()->GetSelectedWebContents(); 113 WebContents* web_contents = browser()->GetSelectedWebContents();
114 ASSERT_TRUE(web_contents != NULL); 114 ASSERT_TRUE(web_contents != NULL);
115 views::Widget::CreateWindowWithParent( 115 views::Widget::CreateWindowWithParent(
116 html_view, web_contents->GetView()->GetTopLevelNativeWindow()); 116 html_view, web_contents->GetView()->GetTopLevelNativeWindow());
117 html_view->InitDialog();
117 html_view->GetWidget()->Show(); 118 html_view->GetWidget()->Show();
118 119
119 // TestHtmlDialogView should quit current message loop on size change. 120 // TestHtmlDialogView should quit current message loop on size change.
120 html_view->set_should_quit_on_size_change(true); 121 html_view->set_should_quit_on_size_change(true);
121 122
122 gfx::Rect bounds = html_view->GetWidget()->GetClientAreaScreenBounds(); 123 gfx::Rect bounds = html_view->GetWidget()->GetClientAreaScreenBounds();
123 124
124 gfx::Rect set_bounds = bounds; 125 gfx::Rect set_bounds = bounds;
125 gfx::Rect actual_bounds, rwhv_bounds; 126 gfx::Rect actual_bounds, rwhv_bounds;
126 127
127 // Bigger than the default in both dimensions. 128 // Bigger than the default in both dimensions.
128 set_bounds.set_width(400); 129 set_bounds.set_width(400);
129 set_bounds.set_height(300); 130 set_bounds.set_height(300);
130 131
131 html_view->MoveContents(web_contents, set_bounds); 132 html_view->MoveContents(web_contents, set_bounds);
132 ui_test_utils::RunMessageLoop(); // TestHtmlDialogView will quit. 133 ui_test_utils::RunMessageLoop(); // TestHtmlDialogView will quit.
133 actual_bounds = html_view->GetWidget()->GetClientAreaScreenBounds(); 134 actual_bounds = html_view->GetWidget()->GetClientAreaScreenBounds();
134 EXPECT_EQ(set_bounds, actual_bounds); 135 EXPECT_EQ(set_bounds, actual_bounds);
135 136
136 rwhv_bounds = 137 rwhv_bounds = html_view->dom_contents()->web_contents()->
137 html_view->web_contents()->GetRenderWidgetHostView()->GetViewBounds(); 138 GetRenderWidgetHostView()->GetViewBounds();
138 EXPECT_LT(0, rwhv_bounds.width()); 139 EXPECT_LT(0, rwhv_bounds.width());
139 EXPECT_LT(0, rwhv_bounds.height()); 140 EXPECT_LT(0, rwhv_bounds.height());
140 EXPECT_GE(set_bounds.width(), rwhv_bounds.width()); 141 EXPECT_GE(set_bounds.width(), rwhv_bounds.width());
141 EXPECT_GE(set_bounds.height(), rwhv_bounds.height()); 142 EXPECT_GE(set_bounds.height(), rwhv_bounds.height());
142 143
143 // Larger in one dimension and smaller in the other. 144 // Larger in one dimension and smaller in the other.
144 set_bounds.set_width(550); 145 set_bounds.set_width(550);
145 set_bounds.set_height(250); 146 set_bounds.set_height(250);
146 147
147 html_view->MoveContents(web_contents, set_bounds); 148 html_view->MoveContents(web_contents, set_bounds);
148 ui_test_utils::RunMessageLoop(); // TestHtmlDialogView will quit. 149 ui_test_utils::RunMessageLoop(); // TestHtmlDialogView will quit.
149 actual_bounds = html_view->GetWidget()->GetClientAreaScreenBounds(); 150 actual_bounds = html_view->GetWidget()->GetClientAreaScreenBounds();
150 EXPECT_EQ(set_bounds, actual_bounds); 151 EXPECT_EQ(set_bounds, actual_bounds);
151 152
152 rwhv_bounds = 153 rwhv_bounds = html_view->dom_contents()->web_contents()->
153 html_view->web_contents()->GetRenderWidgetHostView()->GetViewBounds(); 154 GetRenderWidgetHostView()->GetViewBounds();
154 EXPECT_LT(0, rwhv_bounds.width()); 155 EXPECT_LT(0, rwhv_bounds.width());
155 EXPECT_LT(0, rwhv_bounds.height()); 156 EXPECT_LT(0, rwhv_bounds.height());
156 EXPECT_GE(set_bounds.width(), rwhv_bounds.width()); 157 EXPECT_GE(set_bounds.width(), rwhv_bounds.width());
157 EXPECT_GE(set_bounds.height(), rwhv_bounds.height()); 158 EXPECT_GE(set_bounds.height(), rwhv_bounds.height());
158 159
159 // Get very small. 160 // Get very small.
160 gfx::Size min_size = html_view->GetWidget()->GetMinimumSize(); 161 gfx::Size min_size = html_view->GetWidget()->GetMinimumSize();
161 set_bounds.set_size(min_size); 162 set_bounds.set_size(min_size);
162 163
163 html_view->MoveContents(web_contents, set_bounds); 164 html_view->MoveContents(web_contents, set_bounds);
164 ui_test_utils::RunMessageLoop(); // TestHtmlDialogView will quit. 165 ui_test_utils::RunMessageLoop(); // TestHtmlDialogView will quit.
165 actual_bounds = html_view->GetWidget()->GetClientAreaScreenBounds(); 166 actual_bounds = html_view->GetWidget()->GetClientAreaScreenBounds();
166 EXPECT_EQ(set_bounds, actual_bounds); 167 EXPECT_EQ(set_bounds, actual_bounds);
167 168
168 rwhv_bounds = 169 rwhv_bounds = html_view->dom_contents()->web_contents()->
169 html_view->web_contents()->GetRenderWidgetHostView()->GetViewBounds(); 170 GetRenderWidgetHostView()->GetViewBounds();
170 EXPECT_LT(0, rwhv_bounds.width()); 171 EXPECT_LT(0, rwhv_bounds.width());
171 EXPECT_LT(0, rwhv_bounds.height()); 172 EXPECT_LT(0, rwhv_bounds.height());
172 EXPECT_GE(set_bounds.width(), rwhv_bounds.width()); 173 EXPECT_GE(set_bounds.width(), rwhv_bounds.width());
173 EXPECT_GE(set_bounds.height(), rwhv_bounds.height()); 174 EXPECT_GE(set_bounds.height(), rwhv_bounds.height());
174 175
175 // Check to make sure we can't get to 0x0 176 // Check to make sure we can't get to 0x0
176 set_bounds.set_width(0); 177 set_bounds.set_width(0);
177 set_bounds.set_height(0); 178 set_bounds.set_height(0);
178 179
179 html_view->MoveContents(web_contents, set_bounds); 180 html_view->MoveContents(web_contents, set_bounds);
(...skipping 19 matching lines...) Expand all
199 html_view->InitDialog(); 200 html_view->InitDialog();
200 html_view->GetWidget()->Show(); 201 html_view->GetWidget()->Show();
201 202
202 // TestHtmlDialogView::OnTabMainFrameRender() will Quit(). 203 // TestHtmlDialogView::OnTabMainFrameRender() will Quit().
203 MessageLoopForUI::current()->Run(); 204 MessageLoopForUI::current()->Run();
204 205
205 EXPECT_TRUE(html_view->painted()); 206 EXPECT_TRUE(html_view->painted());
206 207
207 html_view->GetWidget()->Close(); 208 html_view->GetWidget()->Close();
208 } 209 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/html_dialog_view.cc ('k') | chrome/browser/ui/views/keyboard_overlay_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698