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

Side by Side Diff: chrome/browser/ui/panels/old_detached_panel_browsertest.cc

Issue 10544113: Revert 141690 - Modify old Panel test files and include them in .gyp. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 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/message_loop.h" 5 #include "base/message_loop.h"
6 #include "chrome/browser/ui/panels/old_base_panel_browser_test.h" 6 #include "chrome/browser/ui/panels/base_panel_browser_test.h"
7 #include "chrome/browser/ui/panels/detached_panel_strip.h" 7 #include "chrome/browser/ui/panels/detached_panel_strip.h"
8 #include "chrome/browser/ui/panels/native_panel.h" 8 #include "chrome/browser/ui/panels/native_panel.h"
9 #include "chrome/browser/ui/panels/panel.h" 9 #include "chrome/browser/ui/panels/panel.h"
10 #include "chrome/browser/ui/panels/panel_manager.h" 10 #include "chrome/browser/ui/panels/panel_manager.h"
11 11
12 class OldDetachedPanelBrowserTest : public OldBasePanelBrowserTest { 12 class DetachedPanelBrowserTest : public BasePanelBrowserTest {
13 }; 13 };
14 14
15 IN_PROC_BROWSER_TEST_F(OldDetachedPanelBrowserTest, 15 IN_PROC_BROWSER_TEST_F(DetachedPanelBrowserTest, CheckDetachedPanelProperties) {
16 CheckDetachedPanelProperties) {
17 PanelManager* panel_manager = PanelManager::GetInstance(); 16 PanelManager* panel_manager = PanelManager::GetInstance();
18 DetachedPanelStrip* detached_strip = panel_manager->detached_strip(); 17 DetachedPanelStrip* detached_strip = panel_manager->detached_strip();
19 18
20 Panel* panel = CreateDetachedPanel("1", gfx::Rect(300, 200, 250, 200)); 19 Panel* panel = CreateDetachedPanel("1", gfx::Rect(300, 200, 250, 200));
21 scoped_ptr<NativePanelTesting> panel_testing( 20 scoped_ptr<NativePanelTesting> panel_testing(
22 NativePanelTesting::Create(panel->native_panel())); 21 NativePanelTesting::Create(panel->native_panel()));
23 22
24 EXPECT_EQ(1, panel_manager->num_panels()); 23 EXPECT_EQ(1, panel_manager->num_panels());
25 EXPECT_TRUE(detached_strip->HasPanel(panel)); 24 EXPECT_TRUE(detached_strip->HasPanel(panel));
26 25
27 EXPECT_FALSE(panel->always_on_top()); 26 EXPECT_FALSE(panel->always_on_top());
28 27
29 EXPECT_TRUE(panel_testing->IsButtonVisible(panel::CLOSE_BUTTON)); 28 EXPECT_TRUE(panel_testing->IsButtonVisible(panel::CLOSE_BUTTON));
30 EXPECT_FALSE(panel_testing->IsButtonVisible(panel::MINIMIZE_BUTTON)); 29 EXPECT_FALSE(panel_testing->IsButtonVisible(panel::MINIMIZE_BUTTON));
31 EXPECT_FALSE(panel_testing->IsButtonVisible(panel::RESTORE_BUTTON)); 30 EXPECT_FALSE(panel_testing->IsButtonVisible(panel::RESTORE_BUTTON));
32 31
33 EXPECT_EQ(panel::RESIZABLE_ALL_SIDES, panel->CanResizeByMouse()); 32 EXPECT_EQ(panel::RESIZABLE_ALL_SIDES, panel->CanResizeByMouse());
34 33
35 Panel::AttentionMode expected_attention_mode = 34 Panel::AttentionMode expected_attention_mode =
36 static_cast<Panel::AttentionMode>(Panel::USE_PANEL_ATTENTION | 35 static_cast<Panel::AttentionMode>(Panel::USE_PANEL_ATTENTION |
37 Panel::USE_SYSTEM_ATTENTION); 36 Panel::USE_SYSTEM_ATTENTION);
38 EXPECT_EQ(expected_attention_mode, panel->attention_mode()); 37 EXPECT_EQ(expected_attention_mode, panel->attention_mode());
39 38
40 panel_manager->CloseAll(); 39 panel_manager->CloseAll();
41 } 40 }
42 41
43 IN_PROC_BROWSER_TEST_F(OldDetachedPanelBrowserTest, DrawAttentionOnActive) { 42 IN_PROC_BROWSER_TEST_F(DetachedPanelBrowserTest, DrawAttentionOnActive) {
44 // Create a detached panel that is initially active. 43 // Create a detached panel that is initially active.
45 Panel* panel = CreateDetachedPanel("1", gfx::Rect(300, 200, 250, 200)); 44 Panel* panel = CreateDetachedPanel("1", gfx::Rect(300, 200, 250, 200));
46 scoped_ptr<NativePanelTesting> native_panel_testing( 45 scoped_ptr<NativePanelTesting> native_panel_testing(
47 NativePanelTesting::Create(panel->native_panel())); 46 NativePanelTesting::Create(panel->native_panel()));
48 47
49 // Test that the attention should not be drawn if the detached panel is in 48 // Test that the attention should not be drawn if the detached panel is in
50 // focus. 49 // focus.
51 EXPECT_TRUE(panel->IsActive()); 50 EXPECT_TRUE(panel->IsActive());
52 EXPECT_FALSE(panel->IsDrawingAttention()); 51 EXPECT_FALSE(panel->IsDrawingAttention());
53 panel->FlashFrame(true); 52 panel->FlashFrame(true);
54 EXPECT_FALSE(panel->IsDrawingAttention()); 53 EXPECT_FALSE(panel->IsDrawingAttention());
55 MessageLoop::current()->RunAllPending(); 54 MessageLoop::current()->RunAllPending();
56 EXPECT_FALSE(native_panel_testing->VerifyDrawingAttention()); 55 EXPECT_FALSE(native_panel_testing->VerifyDrawingAttention());
57 56
58 panel->Close(); 57 panel->Close();
59 } 58 }
60 59
61 IN_PROC_BROWSER_TEST_F(OldDetachedPanelBrowserTest, DrawAttentionOnInactive) { 60 IN_PROC_BROWSER_TEST_F(DetachedPanelBrowserTest, DrawAttentionOnInactive) {
62 // Create an inactive detached panel. 61 // Create an inactive detached panel.
63 Panel* panel = CreateDetachedPanel("1", gfx::Rect(300, 200, 250, 200)); 62 Panel* panel = CreateDetachedPanel("1", gfx::Rect(300, 200, 250, 200));
64 panel->Deactivate(); 63 panel->Deactivate();
65 WaitForPanelActiveState(panel, SHOW_AS_INACTIVE); 64 WaitForPanelActiveState(panel, SHOW_AS_INACTIVE);
66 65
67 scoped_ptr<NativePanelTesting> native_panel_testing( 66 scoped_ptr<NativePanelTesting> native_panel_testing(
68 NativePanelTesting::Create(panel->native_panel())); 67 NativePanelTesting::Create(panel->native_panel()));
69 68
70 // Test that the attention is drawn when the detached panel is not in focus. 69 // Test that the attention is drawn when the detached panel is not in focus.
71 EXPECT_FALSE(panel->IsActive()); 70 EXPECT_FALSE(panel->IsActive());
72 EXPECT_FALSE(panel->IsDrawingAttention()); 71 EXPECT_FALSE(panel->IsDrawingAttention());
73 panel->FlashFrame(true); 72 panel->FlashFrame(true);
74 EXPECT_TRUE(panel->IsDrawingAttention()); 73 EXPECT_TRUE(panel->IsDrawingAttention());
75 MessageLoop::current()->RunAllPending(); 74 MessageLoop::current()->RunAllPending();
76 EXPECT_TRUE(native_panel_testing->VerifyDrawingAttention()); 75 EXPECT_TRUE(native_panel_testing->VerifyDrawingAttention());
77 76
78 // Stop drawing attention. 77 // Stop drawing attention.
79 panel->FlashFrame(false); 78 panel->FlashFrame(false);
80 EXPECT_FALSE(panel->IsDrawingAttention()); 79 EXPECT_FALSE(panel->IsDrawingAttention());
81 MessageLoop::current()->RunAllPending(); 80 MessageLoop::current()->RunAllPending();
82 EXPECT_FALSE(native_panel_testing->VerifyDrawingAttention()); 81 EXPECT_FALSE(native_panel_testing->VerifyDrawingAttention());
83 82
84 panel->Close(); 83 panel->Close();
85 } 84 }
86 85
87 IN_PROC_BROWSER_TEST_F(OldDetachedPanelBrowserTest, 86 IN_PROC_BROWSER_TEST_F(DetachedPanelBrowserTest, DrawAttentionResetOnActivate) {
88 DrawAttentionResetOnActivate) {
89 // Create 2 panels so we end up with an inactive panel that can 87 // Create 2 panels so we end up with an inactive panel that can
90 // be made to draw attention. 88 // be made to draw attention.
91 Panel* panel1 = CreatePanel("test panel1"); 89 Panel* panel1 = CreatePanel("test panel1");
92 Panel* panel2 = CreatePanel("test panel2"); 90 Panel* panel2 = CreatePanel("test panel2");
93 91
94 scoped_ptr<NativePanelTesting> native_panel_testing( 92 scoped_ptr<NativePanelTesting> native_panel_testing(
95 NativePanelTesting::Create(panel1->native_panel())); 93 NativePanelTesting::Create(panel1->native_panel()));
96 94
97 // Test that the attention is drawn when the detached panel is not in focus. 95 // Test that the attention is drawn when the detached panel is not in focus.
98 panel1->FlashFrame(true); 96 panel1->FlashFrame(true);
99 EXPECT_TRUE(panel1->IsDrawingAttention()); 97 EXPECT_TRUE(panel1->IsDrawingAttention());
100 MessageLoop::current()->RunAllPending(); 98 MessageLoop::current()->RunAllPending();
101 EXPECT_TRUE(native_panel_testing->VerifyDrawingAttention()); 99 EXPECT_TRUE(native_panel_testing->VerifyDrawingAttention());
102 100
103 // Test that the attention is cleared when panel gets focus. 101 // Test that the attention is cleared when panel gets focus.
104 panel1->Activate(); 102 panel1->Activate();
105 WaitForPanelActiveState(panel1, SHOW_AS_ACTIVE); 103 WaitForPanelActiveState(panel1, SHOW_AS_ACTIVE);
106 EXPECT_FALSE(panel1->IsDrawingAttention()); 104 EXPECT_FALSE(panel1->IsDrawingAttention());
107 EXPECT_FALSE(native_panel_testing->VerifyDrawingAttention()); 105 EXPECT_FALSE(native_panel_testing->VerifyDrawingAttention());
108 106
109 panel1->Close(); 107 panel1->Close();
110 panel2->Close(); 108 panel2->Close();
111 } 109 }
112 110
113 IN_PROC_BROWSER_TEST_F(OldDetachedPanelBrowserTest, ClickTitlebar) { 111 IN_PROC_BROWSER_TEST_F(DetachedPanelBrowserTest, ClickTitlebar) {
114 PanelManager* panel_manager = PanelManager::GetInstance(); 112 PanelManager* panel_manager = PanelManager::GetInstance();
115 113
116 Panel* panel = CreateDetachedPanel("1", gfx::Rect(300, 200, 250, 200)); 114 Panel* panel = CreateDetachedPanel("1", gfx::Rect(300, 200, 250, 200));
117 EXPECT_TRUE(panel->IsActive()); 115 EXPECT_TRUE(panel->IsActive());
118 EXPECT_FALSE(panel->IsMinimized()); 116 EXPECT_FALSE(panel->IsMinimized());
119 117
120 // Clicking on an active detached panel's titlebar has no effect, regardless 118 // Clicking on an active detached panel's titlebar has no effect, regardless
121 // of modifier. 119 // of modifier.
122 scoped_ptr<NativePanelTesting> test_panel( 120 scoped_ptr<NativePanelTesting> test_panel(
123 NativePanelTesting::Create(panel->native_panel())); 121 NativePanelTesting::Create(panel->native_panel()));
(...skipping 13 matching lines...) Expand all
137 EXPECT_FALSE(panel->IsActive()); 135 EXPECT_FALSE(panel->IsActive());
138 136
139 // Clicking on an inactive detached panel's titlebar activates it. 137 // Clicking on an inactive detached panel's titlebar activates it.
140 test_panel->PressLeftMouseButtonTitlebar(panel->GetBounds().origin()); 138 test_panel->PressLeftMouseButtonTitlebar(panel->GetBounds().origin());
141 test_panel->ReleaseMouseButtonTitlebar(); 139 test_panel->ReleaseMouseButtonTitlebar();
142 WaitForPanelActiveState(panel, SHOW_AS_ACTIVE); 140 WaitForPanelActiveState(panel, SHOW_AS_ACTIVE);
143 EXPECT_FALSE(panel->IsMinimized()); 141 EXPECT_FALSE(panel->IsMinimized());
144 142
145 panel_manager->CloseAll(); 143 panel_manager->CloseAll();
146 } 144 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/old_base_panel_browser_test.cc ('k') | chrome/browser/ui/panels/old_docked_panel_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698