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

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

Issue 10689082: Fix flaky linux panel tests related to active state checks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleaned up log msgs. Add fix to new tests. Created 8 years, 5 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/old_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"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 EXPECT_TRUE(panel->IsActive()); 51 EXPECT_TRUE(panel->IsActive());
52 EXPECT_FALSE(panel->IsDrawingAttention()); 52 EXPECT_FALSE(panel->IsDrawingAttention());
53 panel->FlashFrame(true); 53 panel->FlashFrame(true);
54 EXPECT_FALSE(panel->IsDrawingAttention()); 54 EXPECT_FALSE(panel->IsDrawingAttention());
55 MessageLoop::current()->RunAllPending(); 55 MessageLoop::current()->RunAllPending();
56 EXPECT_FALSE(native_panel_testing->VerifyDrawingAttention()); 56 EXPECT_FALSE(native_panel_testing->VerifyDrawingAttention());
57 57
58 panel->Close(); 58 panel->Close();
59 } 59 }
60 60
61 // http://crbug.com/135377
62 #if defined(OS_LINUX)
63 #define MAYBE_DrawAttentionOnInactive DISABLED_DrawAttentionOnInactive
64 #else
65 #define MAYBE_DrawAttentionOnInactive DrawAttentionOnInactive
66 #endif
67
68 IN_PROC_BROWSER_TEST_F(OldDetachedPanelBrowserTest, 61 IN_PROC_BROWSER_TEST_F(OldDetachedPanelBrowserTest,
69 MAYBE_DrawAttentionOnInactive) { 62 DrawAttentionOnInactive) {
70 // Create an inactive detached panel. 63 // Create an inactive detached panel.
71 Panel* panel = CreateDetachedPanel("1", gfx::Rect(300, 200, 250, 200)); 64 Panel* panel = CreateDetachedPanel("1", gfx::Rect(300, 200, 250, 200));
72 panel->Deactivate(); 65 panel->Deactivate();
73 WaitForPanelActiveState(panel, SHOW_AS_INACTIVE); 66 WaitForPanelActiveState(panel, SHOW_AS_INACTIVE);
74 67
75 scoped_ptr<NativePanelTesting> native_panel_testing( 68 scoped_ptr<NativePanelTesting> native_panel_testing(
76 CreateNativePanelTesting(panel)); 69 CreateNativePanelTesting(panel));
77 70
78 // Test that the attention is drawn when the detached panel is not in focus. 71 // Test that the attention is drawn when the detached panel is not in focus.
79 EXPECT_FALSE(panel->IsActive()); 72 EXPECT_FALSE(panel->IsActive());
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 // Test that the attention is cleared when panel gets focus. 111 // Test that the attention is cleared when panel gets focus.
119 panel1->Activate(); 112 panel1->Activate();
120 WaitForPanelActiveState(panel1, SHOW_AS_ACTIVE); 113 WaitForPanelActiveState(panel1, SHOW_AS_ACTIVE);
121 EXPECT_FALSE(panel1->IsDrawingAttention()); 114 EXPECT_FALSE(panel1->IsDrawingAttention());
122 EXPECT_FALSE(native_panel_testing->VerifyDrawingAttention()); 115 EXPECT_FALSE(native_panel_testing->VerifyDrawingAttention());
123 116
124 panel1->Close(); 117 panel1->Close();
125 panel2->Close(); 118 panel2->Close();
126 } 119 }
127 120
128 // http://crbug.com/135377 121 IN_PROC_BROWSER_TEST_F(OldDetachedPanelBrowserTest, ClickTitlebar) {
129 #if defined(OS_LINUX)
130 #define MAYBE_ClickTitlebar DISABLED_ClickTitlebar
131 #else
132 #define MAYBE_ClickTitlebar ClickTitlebar
133 #endif
134
135 IN_PROC_BROWSER_TEST_F(OldDetachedPanelBrowserTest, MAYBE_ClickTitlebar) {
136 PanelManager* panel_manager = PanelManager::GetInstance(); 122 PanelManager* panel_manager = PanelManager::GetInstance();
137 123
138 Panel* panel = CreateDetachedPanel("1", gfx::Rect(300, 200, 250, 200)); 124 Panel* panel = CreateDetachedPanel("1", gfx::Rect(300, 200, 250, 200));
139 EXPECT_TRUE(panel->IsActive()); 125 EXPECT_TRUE(panel->IsActive());
140 EXPECT_FALSE(panel->IsMinimized()); 126 EXPECT_FALSE(panel->IsMinimized());
141 127
142 // Clicking on an active detached panel's titlebar has no effect, regardless 128 // Clicking on an active detached panel's titlebar has no effect, regardless
143 // of modifier. 129 // of modifier.
144 scoped_ptr<NativePanelTesting> test_panel( 130 scoped_ptr<NativePanelTesting> test_panel(
145 CreateNativePanelTesting(panel)); 131 CreateNativePanelTesting(panel));
146 test_panel->PressLeftMouseButtonTitlebar(panel->GetBounds().origin()); 132 test_panel->PressLeftMouseButtonTitlebar(panel->GetBounds().origin());
147 test_panel->ReleaseMouseButtonTitlebar(); 133 test_panel->ReleaseMouseButtonTitlebar();
148 EXPECT_TRUE(panel->IsActive()); 134 EXPECT_TRUE(panel->IsActive());
149 EXPECT_FALSE(panel->IsMinimized()); 135 EXPECT_FALSE(panel->IsMinimized());
150 136
151 test_panel->PressLeftMouseButtonTitlebar(panel->GetBounds().origin(), 137 test_panel->PressLeftMouseButtonTitlebar(panel->GetBounds().origin(),
152 panel::APPLY_TO_ALL); 138 panel::APPLY_TO_ALL);
153 test_panel->ReleaseMouseButtonTitlebar(panel::APPLY_TO_ALL); 139 test_panel->ReleaseMouseButtonTitlebar(panel::APPLY_TO_ALL);
154 EXPECT_TRUE(panel->IsActive()); 140 EXPECT_TRUE(panel->IsActive());
155 EXPECT_FALSE(panel->IsMinimized()); 141 EXPECT_FALSE(panel->IsMinimized());
156 142
157 // Create a second panel to cause the first to become inactive. 143 // Create a second panel to cause the first to become inactive.
158 CreateDetachedPanel("2", gfx::Rect(100, 200, 230, 345)); 144 CreateDetachedPanel("2", gfx::Rect(100, 200, 230, 345));
159 EXPECT_FALSE(panel->IsActive()); 145 WaitForPanelActiveState(panel, SHOW_AS_INACTIVE);
160 146
161 // Clicking on an inactive detached panel's titlebar activates it. 147 // Clicking on an inactive detached panel's titlebar activates it.
162 test_panel->PressLeftMouseButtonTitlebar(panel->GetBounds().origin()); 148 test_panel->PressLeftMouseButtonTitlebar(panel->GetBounds().origin());
163 test_panel->ReleaseMouseButtonTitlebar(); 149 test_panel->ReleaseMouseButtonTitlebar();
164 WaitForPanelActiveState(panel, SHOW_AS_ACTIVE); 150 WaitForPanelActiveState(panel, SHOW_AS_ACTIVE);
165 EXPECT_FALSE(panel->IsMinimized()); 151 EXPECT_FALSE(panel->IsMinimized());
166 152
167 panel_manager->CloseAll(); 153 panel_manager->CloseAll();
168 } 154 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698