OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/ui/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
6 #include "chrome/browser/ui/views/dom_view.h" | 6 #include "chrome/browser/ui/views/dom_view.h" |
7 #include "chrome/test/in_process_browser_test.h" | 7 #include "chrome/test/in_process_browser_test.h" |
8 #include "chrome/test/ui_test_utils.h" | 8 #include "chrome/test/ui_test_utils.h" |
9 #include "views/widget/root_view.h" | 9 #include "views/widget/root_view.h" |
10 #include "views/widget/widget.h" | 10 #include "views/widget/widget.h" |
11 | 11 |
12 using views::Widget; | 12 using views::Widget; |
13 | 13 |
14 class DOMViewTest : public InProcessBrowserTest { | 14 class DOMViewTest : public InProcessBrowserTest { |
15 public: | 15 public: |
16 Widget* CreatePopupWindow() { | 16 Widget* CreatePopupWindow() { |
17 Widget* widget = Widget::CreateWidget(); | 17 Widget* widget = new Widget; |
18 Widget::InitParams params(Widget::InitParams::TYPE_POPUP); | 18 Widget::InitParams params(Widget::InitParams::TYPE_POPUP); |
19 params.bounds = gfx::Rect(0, 0, 400, 400); | 19 params.bounds = gfx::Rect(0, 0, 400, 400); |
20 widget->Init(params); | 20 widget->Init(params); |
21 return widget; | 21 return widget; |
22 } | 22 } |
23 }; | 23 }; |
24 | 24 |
25 // Tests if creating and deleting dom_view | 25 // Tests if creating and deleting dom_view |
26 // does not crash and leak memory. | 26 // does not crash and leak memory. |
27 IN_PROC_BROWSER_TEST_F(DOMViewTest, TestShowAndHide) { | 27 IN_PROC_BROWSER_TEST_F(DOMViewTest, TestShowAndHide) { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 82 |
83 // Re-attach to another Widget. | 83 // Re-attach to another Widget. |
84 Widget* two = CreatePopupWindow(); | 84 Widget* two = CreatePopupWindow(); |
85 two->GetRootView()->AddChildView(dom_view); | 85 two->GetRootView()->AddChildView(dom_view); |
86 two->Show(); | 86 two->Show(); |
87 | 87 |
88 ui_test_utils::RunAllPendingInMessageLoop(); | 88 ui_test_utils::RunAllPendingInMessageLoop(); |
89 | 89 |
90 two->Hide(); | 90 two->Hide(); |
91 } | 91 } |
OLD | NEW |