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 "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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 panel1->Close(); | 287 panel1->Close(); |
288 panel2->Close(); | 288 panel2->Close(); |
289 panel3->Close(); | 289 panel3->Close(); |
290 EXPECT_EQ(0, panel_manager->minimized_panel_count()); | 290 EXPECT_EQ(0, panel_manager->minimized_panel_count()); |
291 } | 291 } |
292 | 292 |
293 void TestDrawAttention() { | 293 void TestDrawAttention() { |
294 Panel* panel = CreatePanel("PanelTest"); | 294 Panel* panel = CreatePanel("PanelTest"); |
295 PanelBrowserView* browser_view = GetBrowserView(panel); | 295 PanelBrowserView* browser_view = GetBrowserView(panel); |
296 PanelBrowserFrameView* frame_view = browser_view->GetFrameView(); | 296 PanelBrowserFrameView* frame_view = browser_view->GetFrameView(); |
| 297 frame_view->title_label_->SetAutoColorReadabilityEnabled(false); |
297 SkColor attention_color = frame_view->GetTitleColor( | 298 SkColor attention_color = frame_view->GetTitleColor( |
298 PanelBrowserFrameView::PAINT_FOR_ATTENTION); | 299 PanelBrowserFrameView::PAINT_FOR_ATTENTION); |
299 | 300 |
300 // Test that the attention should not be drawn if the expanded panel is in | 301 // Test that the attention should not be drawn if the expanded panel is in |
301 // focus. | 302 // focus. |
302 browser_view->DrawAttention(); | 303 browser_view->DrawAttention(); |
303 EXPECT_FALSE(browser_view->IsDrawingAttention()); | 304 EXPECT_FALSE(browser_view->IsDrawingAttention()); |
304 MessageLoopForUI::current()->RunAllPending(); | 305 MessageLoopForUI::current()->RunAllPending(); |
305 EXPECT_NE(attention_color, frame_view->title_label_->GetColor()); | 306 EXPECT_NE(attention_color, frame_view->title_label_->enabled_color()); |
306 | 307 |
307 // Test that the attention is drawn when the expanded panel is not in focus. | 308 // Test that the attention is drawn when the expanded panel is not in focus. |
308 panel->Deactivate(); | 309 panel->Deactivate(); |
309 browser_view->DrawAttention(); | 310 browser_view->DrawAttention(); |
310 EXPECT_TRUE(browser_view->IsDrawingAttention()); | 311 EXPECT_TRUE(browser_view->IsDrawingAttention()); |
311 MessageLoopForUI::current()->RunAllPending(); | 312 MessageLoopForUI::current()->RunAllPending(); |
312 EXPECT_EQ(attention_color, frame_view->title_label_->GetColor()); | 313 EXPECT_EQ(attention_color, frame_view->title_label_->enabled_color()); |
313 | 314 |
314 // Test that the attention is cleared. | 315 // Test that the attention is cleared. |
315 browser_view->StopDrawingAttention(); | 316 browser_view->StopDrawingAttention(); |
316 EXPECT_FALSE(browser_view->IsDrawingAttention()); | 317 EXPECT_FALSE(browser_view->IsDrawingAttention()); |
317 MessageLoopForUI::current()->RunAllPending(); | 318 MessageLoopForUI::current()->RunAllPending(); |
318 EXPECT_NE(attention_color, frame_view->title_label_->GetColor()); | 319 EXPECT_NE(attention_color, frame_view->title_label_->enabled_color()); |
319 | 320 |
320 // Test that the attention is drawn and the title-bar is brought up when the | 321 // Test that the attention is drawn and the title-bar is brought up when the |
321 // minimized panel is not in focus. | 322 // minimized panel is not in focus. |
322 panel->Deactivate(); | 323 panel->Deactivate(); |
323 panel->SetExpansionState(Panel::MINIMIZED); | 324 panel->SetExpansionState(Panel::MINIMIZED); |
324 EXPECT_EQ(Panel::MINIMIZED, panel->expansion_state()); | 325 EXPECT_EQ(Panel::MINIMIZED, panel->expansion_state()); |
325 browser_view->DrawAttention(); | 326 browser_view->DrawAttention(); |
326 EXPECT_TRUE(browser_view->IsDrawingAttention()); | 327 EXPECT_TRUE(browser_view->IsDrawingAttention()); |
327 EXPECT_EQ(Panel::TITLE_ONLY, panel->expansion_state()); | 328 EXPECT_EQ(Panel::TITLE_ONLY, panel->expansion_state()); |
328 MessageLoopForUI::current()->RunAllPending(); | 329 MessageLoopForUI::current()->RunAllPending(); |
329 EXPECT_EQ(attention_color, frame_view->title_label_->GetColor()); | 330 EXPECT_EQ(attention_color, frame_view->title_label_->enabled_color()); |
330 | 331 |
331 // Test that we cannot bring up other minimized panel if the mouse is over | 332 // Test that we cannot bring up other minimized panel if the mouse is over |
332 // the panel that draws attension. | 333 // the panel that draws attension. |
333 EXPECT_FALSE(PanelManager::GetInstance()-> | 334 EXPECT_FALSE(PanelManager::GetInstance()-> |
334 ShouldBringUpTitlebars(panel->GetBounds().x(), panel->GetBounds().y())); | 335 ShouldBringUpTitlebars(panel->GetBounds().x(), panel->GetBounds().y())); |
335 | 336 |
336 // Test that we cannot bring down the panel that is drawing the attention. | 337 // Test that we cannot bring down the panel that is drawing the attention. |
337 PanelManager::GetInstance()->BringUpOrDownTitlebars(false); | 338 PanelManager::GetInstance()->BringUpOrDownTitlebars(false); |
338 EXPECT_EQ(Panel::TITLE_ONLY, panel->expansion_state()); | 339 EXPECT_EQ(Panel::TITLE_ONLY, panel->expansion_state()); |
339 | 340 |
340 // Test that the attention is cleared. | 341 // Test that the attention is cleared. |
341 browser_view->StopDrawingAttention(); | 342 browser_view->StopDrawingAttention(); |
342 EXPECT_FALSE(browser_view->IsDrawingAttention()); | 343 EXPECT_FALSE(browser_view->IsDrawingAttention()); |
343 EXPECT_EQ(Panel::EXPANDED, panel->expansion_state()); | 344 EXPECT_EQ(Panel::EXPANDED, panel->expansion_state()); |
344 MessageLoopForUI::current()->RunAllPending(); | 345 MessageLoopForUI::current()->RunAllPending(); |
345 EXPECT_NE(attention_color, frame_view->title_label_->GetColor()); | 346 EXPECT_NE(attention_color, frame_view->title_label_->enabled_color()); |
346 | 347 |
347 panel->Close(); | 348 panel->Close(); |
348 } | 349 } |
349 | 350 |
350 void TestChangeAutoHideTaskBarThickness() { | 351 void TestChangeAutoHideTaskBarThickness() { |
351 int bottom_bar_thickness = 20; | 352 int bottom_bar_thickness = 20; |
352 int right_bar_thickness = 30; | 353 int right_bar_thickness = 30; |
353 mock_auto_hiding_desktop_bar()->EnableAutoHiding( | 354 mock_auto_hiding_desktop_bar()->EnableAutoHiding( |
354 AutoHidingDesktopBar::ALIGN_BOTTOM, true, bottom_bar_thickness); | 355 AutoHidingDesktopBar::ALIGN_BOTTOM, true, bottom_bar_thickness); |
355 mock_auto_hiding_desktop_bar()->EnableAutoHiding( | 356 mock_auto_hiding_desktop_bar()->EnableAutoHiding( |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 | 579 |
579 // TODO(jianli): Investigate why this fails on win trunk build. | 580 // TODO(jianli): Investigate why this fails on win trunk build. |
580 IN_PROC_BROWSER_TEST_F(PanelBrowserViewTest, DISABLED_DrawAttention) { | 581 IN_PROC_BROWSER_TEST_F(PanelBrowserViewTest, DISABLED_DrawAttention) { |
581 TestDrawAttention(); | 582 TestDrawAttention(); |
582 } | 583 } |
583 | 584 |
584 IN_PROC_BROWSER_TEST_F(PanelBrowserViewTest, ChangeAutoHideTaskBarThickness) { | 585 IN_PROC_BROWSER_TEST_F(PanelBrowserViewTest, ChangeAutoHideTaskBarThickness) { |
585 TestChangeAutoHideTaskBarThickness(); | 586 TestChangeAutoHideTaskBarThickness(); |
586 } | 587 } |
587 #endif | 588 #endif |
OLD | NEW |