| 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 namespace views; | 12 using namespace views; |
| 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::CreateParams params(Widget::CreateParams::TYPE_POPUP); | 18 Widget::CreateParams params(Widget::CreateParams::TYPE_POPUP); |
| 18 params.mirror_origin_in_rtl = false; | 19 params.bounds = gfx::Rect(0, 0, 400, 400); |
| 19 Widget* widget = Widget::CreateWidget(params); | 20 widget->Init(params); |
| 20 widget->Init(NULL, gfx::Rect(0, 0, 400, 400)); | |
| 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) { |
| 28 Widget* one = CreatePopupWindow(); | 28 Widget* one = CreatePopupWindow(); |
| 29 | 29 |
| 30 DOMView* dom_view = new DOMView(); | 30 DOMView* dom_view = new DOMView(); |
| (...skipping 51 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 |