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/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" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/browser/ui/browser_tabstrip.h" |
13 #include "chrome/browser/ui/views/web_dialog_view.h" | 14 #include "chrome/browser/ui/views/web_dialog_view.h" |
14 #include "chrome/browser/ui/webui/test_web_dialog_delegate.h" | 15 #include "chrome/browser/ui/webui/test_web_dialog_delegate.h" |
15 #include "chrome/common/url_constants.h" | 16 #include "chrome/common/url_constants.h" |
16 #include "chrome/test/base/in_process_browser_test.h" | 17 #include "chrome/test/base/in_process_browser_test.h" |
17 #include "chrome/test/base/ui_test_utils.h" | 18 #include "chrome/test/base/ui_test_utils.h" |
18 #include "content/public/browser/browser_context.h" | 19 #include "content/public/browser/browser_context.h" |
19 #include "content/public/browser/render_widget_host_view.h" | 20 #include "content/public/browser/render_widget_host_view.h" |
20 #include "content/public/browser/web_contents.h" | 21 #include "content/public/browser/web_contents.h" |
21 #include "content/public/browser/web_contents_view.h" | 22 #include "content/public/browser/web_contents_view.h" |
22 #include "testing/gmock/include/gmock/gmock.h" | 23 #include "testing/gmock/include/gmock/gmock.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 #endif | 93 #endif |
93 | 94 |
94 IN_PROC_BROWSER_TEST_F(WebDialogBrowserTest, MAYBE_SizeWindow) { | 95 IN_PROC_BROWSER_TEST_F(WebDialogBrowserTest, MAYBE_SizeWindow) { |
95 test::TestWebDialogDelegate* delegate = | 96 test::TestWebDialogDelegate* delegate = |
96 new test::TestWebDialogDelegate( | 97 new test::TestWebDialogDelegate( |
97 GURL(chrome::kChromeUIChromeURLsURL)); | 98 GURL(chrome::kChromeUIChromeURLsURL)); |
98 delegate->set_size(kInitialWidth, kInitialHeight); | 99 delegate->set_size(kInitialWidth, kInitialHeight); |
99 | 100 |
100 TestWebDialogView* view = | 101 TestWebDialogView* view = |
101 new TestWebDialogView(browser()->profile(), delegate); | 102 new TestWebDialogView(browser()->profile(), delegate); |
102 WebContents* web_contents = browser()->GetActiveWebContents(); | 103 WebContents* web_contents = chrome::GetActiveWebContents(browser()); |
103 ASSERT_TRUE(web_contents != NULL); | 104 ASSERT_TRUE(web_contents != NULL); |
104 views::Widget::CreateWindowWithParent( | 105 views::Widget::CreateWindowWithParent( |
105 view, web_contents->GetView()->GetTopLevelNativeWindow()); | 106 view, web_contents->GetView()->GetTopLevelNativeWindow()); |
106 view->GetWidget()->Show(); | 107 view->GetWidget()->Show(); |
107 | 108 |
108 // TestWebDialogView should quit current message loop on size change. | 109 // TestWebDialogView should quit current message loop on size change. |
109 view->set_should_quit_on_size_change(true); | 110 view->set_should_quit_on_size_change(true); |
110 | 111 |
111 gfx::Rect bounds = view->GetWidget()->GetClientAreaScreenBounds(); | 112 gfx::Rect bounds = view->GetWidget()->GetClientAreaScreenBounds(); |
112 | 113 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 // Check to make sure we can't get to 0x0 | 165 // Check to make sure we can't get to 0x0 |
165 set_bounds.set_width(0); | 166 set_bounds.set_width(0); |
166 set_bounds.set_height(0); | 167 set_bounds.set_height(0); |
167 | 168 |
168 view->MoveContents(web_contents, set_bounds); | 169 view->MoveContents(web_contents, set_bounds); |
169 ui_test_utils::RunMessageLoop(); // TestWebDialogView will quit. | 170 ui_test_utils::RunMessageLoop(); // TestWebDialogView will quit. |
170 actual_bounds = view->GetWidget()->GetClientAreaScreenBounds(); | 171 actual_bounds = view->GetWidget()->GetClientAreaScreenBounds(); |
171 EXPECT_LT(0, actual_bounds.width()); | 172 EXPECT_LT(0, actual_bounds.width()); |
172 EXPECT_LT(0, actual_bounds.height()); | 173 EXPECT_LT(0, actual_bounds.height()); |
173 } | 174 } |
OLD | NEW |