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

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

Issue 8505047: Fix panels being removed from PanelManager prematurely. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Change test from using notification to timeout. Created 9 years, 1 month 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) 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 "base/i18n/time_formatting.h" 5 #include "base/i18n/time_formatting.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "chrome/browser/extensions/extension_service.h" 7 #include "chrome/browser/extensions/extension_service.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/ui/browser_window.h" 9 #include "chrome/browser/ui/browser_window.h"
10 #include "chrome/browser/ui/panels/base_panel_browser_test.h" 10 #include "chrome/browser/ui/panels/base_panel_browser_test.h"
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 155
156 void WaitTillSettingsAnimationFinished(Panel* panel) { 156 void WaitTillSettingsAnimationFinished(Panel* panel) {
157 // The timer for the animation will only kick in as async task. 157 // The timer for the animation will only kick in as async task.
158 while (GetSettingsButtonAnimator(panel)->is_animating()) { 158 while (GetSettingsButtonAnimator(panel)->is_animating()) {
159 MessageLoopForUI::current()->PostTask(FROM_HERE, 159 MessageLoopForUI::current()->PostTask(FROM_HERE,
160 new MessageLoop::QuitTask()); 160 new MessageLoop::QuitTask());
161 MessageLoopForUI::current()->RunAllPending(); 161 MessageLoopForUI::current()->RunAllPending();
162 } 162 }
163 } 163 }
164 164
165 void ClosePanelAndWaitForNotification(Panel* panel) {
166 ui_test_utils::WindowedNotificationObserver signal(
167 chrome::NOTIFICATION_BROWSER_CLOSED,
168 content::Source<Browser>(panel->browser()));
169 panel->Close();
170 signal.Wait();
171 }
172
165 // We put all the testing logic in this class instead of the test so that 173 // We put all the testing logic in this class instead of the test so that
166 // we do not need to declare each new test as a friend of PanelBrowserView 174 // we do not need to declare each new test as a friend of PanelBrowserView
167 // for the purpose of accessing its private members. 175 // for the purpose of accessing its private members.
168 void TestMinimizeAndRestore(bool enable_auto_hiding) { 176 void TestMinimizeAndRestore(bool enable_auto_hiding) {
169 PanelManager* panel_manager = PanelManager::GetInstance(); 177 PanelManager* panel_manager = PanelManager::GetInstance();
170 int expected_bottom_on_minimized = testing_work_area().height(); 178 int expected_bottom_on_minimized = testing_work_area().height();
171 int expected_bottom_on_unminimized = expected_bottom_on_minimized; 179 int expected_bottom_on_unminimized = expected_bottom_on_minimized;
172 180
173 // Turn on auto-hiding if requested. 181 // Turn on auto-hiding if requested.
174 static const int bottom_thickness = 40; 182 static const int bottom_thickness = 40;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 EXPECT_EQ(2, panel_manager->minimized_panel_count()); 286 EXPECT_EQ(2, panel_manager->minimized_panel_count());
279 EXPECT_FALSE(panel_manager->ShouldBringUpTitlebars( 287 EXPECT_FALSE(panel_manager->ShouldBringUpTitlebars(
280 0, 0)); 288 0, 0));
281 browser_view1->OnTitlebarMousePressed(panel1->GetBounds().origin()); 289 browser_view1->OnTitlebarMousePressed(panel1->GetBounds().origin());
282 browser_view1->OnTitlebarMouseDragged( 290 browser_view1->OnTitlebarMouseDragged(
283 panel1->GetBounds().origin().Subtract(gfx::Point(5, 5))); 291 panel1->GetBounds().origin().Subtract(gfx::Point(5, 5)));
284 EXPECT_TRUE(panel_manager->ShouldBringUpTitlebars( 292 EXPECT_TRUE(panel_manager->ShouldBringUpTitlebars(
285 0, 0)); 293 0, 0));
286 browser_view1->OnTitlebarMouseReleased(); 294 browser_view1->OnTitlebarMouseReleased();
287 295
288 panel1->Close(); 296 ClosePanelAndWaitForNotification(panel1);
289 panel2->Close(); 297 ClosePanelAndWaitForNotification(panel2);
290 panel3->Close(); 298 ClosePanelAndWaitForNotification(panel3);
291 EXPECT_EQ(0, panel_manager->minimized_panel_count()); 299 EXPECT_EQ(0, panel_manager->minimized_panel_count());
292 } 300 }
293 301
294 void TestDrawAttention() { 302 void TestDrawAttention() {
295 Panel* panel = CreatePanel("PanelTest"); 303 Panel* panel = CreatePanel("PanelTest");
296 PanelBrowserView* browser_view = GetBrowserView(panel); 304 PanelBrowserView* browser_view = GetBrowserView(panel);
297 PanelBrowserFrameView* frame_view = browser_view->GetFrameView(); 305 PanelBrowserFrameView* frame_view = browser_view->GetFrameView();
298 frame_view->title_label_->SetAutoColorReadabilityEnabled(false); 306 frame_view->title_label_->SetAutoColorReadabilityEnabled(false);
299 SkColor attention_color = frame_view->GetTitleColor( 307 SkColor attention_color = frame_view->GetTitleColor(
300 PanelBrowserFrameView::PAINT_FOR_ATTENTION); 308 PanelBrowserFrameView::PAINT_FOR_ATTENTION);
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 // TODO(jianli): Investigate why this fails on win trunk build. 608 // TODO(jianli): Investigate why this fails on win trunk build.
601 // http://crbug.com/102734 609 // http://crbug.com/102734
602 IN_PROC_BROWSER_TEST_F(PanelBrowserViewTest, DISABLED_DrawAttention) { 610 IN_PROC_BROWSER_TEST_F(PanelBrowserViewTest, DISABLED_DrawAttention) {
603 TestDrawAttention(); 611 TestDrawAttention();
604 } 612 }
605 613
606 IN_PROC_BROWSER_TEST_F(PanelBrowserViewTest, ChangeAutoHideTaskBarThickness) { 614 IN_PROC_BROWSER_TEST_F(PanelBrowserViewTest, ChangeAutoHideTaskBarThickness) {
607 TestChangeAutoHideTaskBarThickness(); 615 TestChangeAutoHideTaskBarThickness();
608 } 616 }
609 #endif 617 #endif
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/panel_browser_view.cc ('k') | chrome/browser/ui/panels/panel_browser_window_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698