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/widget.h" | 9 #include "views/widget/widget.h" |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 // Tests if creating and deleting dom_view | 24 // Tests if creating and deleting dom_view |
25 // does not crash and leak memory. | 25 // does not crash and leak memory. |
26 IN_PROC_BROWSER_TEST_F(DOMViewTest, TestShowAndHide) { | 26 IN_PROC_BROWSER_TEST_F(DOMViewTest, TestShowAndHide) { |
27 Widget* one = CreatePopupWindow(); | 27 Widget* one = CreatePopupWindow(); |
28 | 28 |
29 DOMView* dom_view = new DOMView(); | 29 DOMView* dom_view = new DOMView(); |
30 one->GetRootView()->AddChildView(dom_view); | 30 one->GetRootView()->AddChildView(dom_view); |
31 | 31 |
32 dom_view->Init(browser()->profile(), NULL); | 32 dom_view->Init(browser()->profile(), NULL); |
33 dom_view->LoadURL(GURL("http://www.google.com")); | 33 dom_view->LoadURL(GURL("http://www.google.com")); |
34 ui_test_utils::WaitForNotification(NotificationType::LOAD_STOP); | 34 ui_test_utils::WaitForNotification(content::NOTIFICATION_LOAD_STOP); |
35 one->Show(); | 35 one->Show(); |
36 | 36 |
37 ui_test_utils::RunAllPendingInMessageLoop(); | 37 ui_test_utils::RunAllPendingInMessageLoop(); |
38 | 38 |
39 one->Hide(); | 39 one->Hide(); |
40 } | 40 } |
41 | 41 |
42 // Tests if removing from tree then deleting dom_view | 42 // Tests if removing from tree then deleting dom_view |
43 // does not crash and leak memory. | 43 // does not crash and leak memory. |
44 IN_PROC_BROWSER_TEST_F(DOMViewTest, TestRemoveAndDelete) { | 44 IN_PROC_BROWSER_TEST_F(DOMViewTest, TestRemoveAndDelete) { |
45 Widget* one = CreatePopupWindow(); | 45 Widget* one = CreatePopupWindow(); |
46 | 46 |
47 DOMView* dom_view = new DOMView(); | 47 DOMView* dom_view = new DOMView(); |
48 one->GetRootView()->AddChildView(dom_view); | 48 one->GetRootView()->AddChildView(dom_view); |
49 | 49 |
50 dom_view->Init(browser()->profile(), NULL); | 50 dom_view->Init(browser()->profile(), NULL); |
51 dom_view->LoadURL(GURL("http://www.google.com")); | 51 dom_view->LoadURL(GURL("http://www.google.com")); |
52 ui_test_utils::WaitForNotification(NotificationType::LOAD_STOP); | 52 ui_test_utils::WaitForNotification(content::NOTIFICATION_LOAD_STOP); |
53 one->Show(); | 53 one->Show(); |
54 | 54 |
55 ui_test_utils::RunAllPendingInMessageLoop(); | 55 ui_test_utils::RunAllPendingInMessageLoop(); |
56 | 56 |
57 one->GetRootView()->RemoveChildView(dom_view); | 57 one->GetRootView()->RemoveChildView(dom_view); |
58 | 58 |
59 delete dom_view; | 59 delete dom_view; |
60 | 60 |
61 one->Hide(); | 61 one->Hide(); |
62 } | 62 } |
63 | 63 |
64 // Tests if reparenting dom_view does not crash and does not leak | 64 // Tests if reparenting dom_view does not crash and does not leak |
65 // memory. | 65 // memory. |
66 IN_PROC_BROWSER_TEST_F(DOMViewTest, TestReparent) { | 66 IN_PROC_BROWSER_TEST_F(DOMViewTest, TestReparent) { |
67 Widget* one = CreatePopupWindow(); | 67 Widget* one = CreatePopupWindow(); |
68 | 68 |
69 DOMView* dom_view = new DOMView(); | 69 DOMView* dom_view = new DOMView(); |
70 one->GetRootView()->AddChildView(dom_view); | 70 one->GetRootView()->AddChildView(dom_view); |
71 | 71 |
72 dom_view->Init(browser()->profile(), NULL); | 72 dom_view->Init(browser()->profile(), NULL); |
73 dom_view->LoadURL(GURL("http://www.google.com")); | 73 dom_view->LoadURL(GURL("http://www.google.com")); |
74 ui_test_utils::WaitForNotification(NotificationType::LOAD_STOP); | 74 ui_test_utils::WaitForNotification(content::NOTIFICATION_LOAD_STOP); |
75 one->Show(); | 75 one->Show(); |
76 | 76 |
77 ui_test_utils::RunAllPendingInMessageLoop(); | 77 ui_test_utils::RunAllPendingInMessageLoop(); |
78 | 78 |
79 one->GetRootView()->RemoveChildView(dom_view); | 79 one->GetRootView()->RemoveChildView(dom_view); |
80 one->Hide(); | 80 one->Hide(); |
81 | 81 |
82 // Re-attach to another Widget. | 82 // Re-attach to another Widget. |
83 Widget* two = CreatePopupWindow(); | 83 Widget* two = CreatePopupWindow(); |
84 two->GetRootView()->AddChildView(dom_view); | 84 two->GetRootView()->AddChildView(dom_view); |
85 two->Show(); | 85 two->Show(); |
86 | 86 |
87 ui_test_utils::RunAllPendingInMessageLoop(); | 87 ui_test_utils::RunAllPendingInMessageLoop(); |
88 | 88 |
89 two->Hide(); | 89 two->Hide(); |
90 } | 90 } |
OLD | NEW |