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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/i18n/time_formatting.h" | 6 #include "base/i18n/time_formatting.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.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/browser_window.h" | 10 #include "chrome/browser/ui/browser_window.h" |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
212 int titlebar_height = | 212 int titlebar_height = |
213 browser_view1->GetFrameView()->NonClientTopBorderHeight(); | 213 browser_view1->GetFrameView()->NonClientTopBorderHeight(); |
214 | 214 |
215 panel1->SetExpansionState(Panel::MINIMIZED); | 215 panel1->SetExpansionState(Panel::MINIMIZED); |
216 EXPECT_EQ(Panel::MINIMIZED, panel1->expansion_state()); | 216 EXPECT_EQ(Panel::MINIMIZED, panel1->expansion_state()); |
217 EXPECT_LT(panel1->GetBounds().height(), titlebar_height); | 217 EXPECT_LT(panel1->GetBounds().height(), titlebar_height); |
218 EXPECT_GT(panel1->GetBounds().height(), 0); | 218 EXPECT_GT(panel1->GetBounds().height(), 0); |
219 EXPECT_TRUE(IsMouseWatcherStarted()); | 219 EXPECT_TRUE(IsMouseWatcherStarted()); |
220 EXPECT_FALSE(panel1->IsActive()); | 220 EXPECT_FALSE(panel1->IsActive()); |
221 WaitTillBoundsAnimationFinished(browser_view1); | 221 WaitTillBoundsAnimationFinished(browser_view1); |
222 // TODO(jianli): Enable the following checks after the patch to support | |
223 // minimizing window to 3-pixel line is landed. | |
224 //EXPECT_FALSE(frame_view1->close_button_->IsVisible()); | |
225 //EXPECT_FALSE(frame_view1->title_icon_->IsVisible()); | |
226 //EXPECT_FALSE(frame_view1->title_label_->IsVisible()); | |
227 | 222 |
228 panel1->SetExpansionState(Panel::TITLE_ONLY); | 223 panel1->SetExpansionState(Panel::TITLE_ONLY); |
229 EXPECT_EQ(Panel::TITLE_ONLY, panel1->expansion_state()); | 224 EXPECT_EQ(Panel::TITLE_ONLY, panel1->expansion_state()); |
230 EXPECT_EQ(titlebar_height, panel1->GetBounds().height()); | 225 EXPECT_EQ(titlebar_height, panel1->GetBounds().height()); |
231 WaitTillBoundsAnimationFinished(browser_view1); | 226 WaitTillBoundsAnimationFinished(browser_view1); |
232 EXPECT_TRUE(frame_view1->close_button_->IsVisible()); | 227 EXPECT_TRUE(frame_view1->close_button_->IsVisible()); |
233 EXPECT_TRUE(frame_view1->title_icon_->IsVisible()); | 228 EXPECT_TRUE(frame_view1->title_icon_->IsVisible()); |
234 EXPECT_TRUE(frame_view1->title_label_->IsVisible()); | 229 EXPECT_TRUE(frame_view1->title_label_->IsVisible()); |
235 | 230 |
236 panel1->SetExpansionState(Panel::EXPANDED); | 231 panel1->SetExpansionState(Panel::EXPANDED); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
281 panel1->GetBounds().x(), panel1->GetBounds().y())); | 276 panel1->GetBounds().x(), panel1->GetBounds().y())); |
282 EXPECT_FALSE(panel_manager->ShouldBringUpTitlebarForAllMinimizedPanels( | 277 EXPECT_FALSE(panel_manager->ShouldBringUpTitlebarForAllMinimizedPanels( |
283 panel2->GetBounds().x(), panel2->GetBounds().y())); | 278 panel2->GetBounds().x(), panel2->GetBounds().y())); |
284 EXPECT_TRUE(panel_manager->ShouldBringUpTitlebarForAllMinimizedPanels( | 279 EXPECT_TRUE(panel_manager->ShouldBringUpTitlebarForAllMinimizedPanels( |
285 panel3->GetBounds().right() - 1, panel3->GetBounds().bottom() - 1)); | 280 panel3->GetBounds().right() - 1, panel3->GetBounds().bottom() - 1)); |
286 EXPECT_TRUE(panel_manager->ShouldBringUpTitlebarForAllMinimizedPanels( | 281 EXPECT_TRUE(panel_manager->ShouldBringUpTitlebarForAllMinimizedPanels( |
287 panel3->GetBounds().right() - 1, panel3->GetBounds().bottom() + 10)); | 282 panel3->GetBounds().right() - 1, panel3->GetBounds().bottom() + 10)); |
288 EXPECT_FALSE(panel_manager->ShouldBringUpTitlebarForAllMinimizedPanels( | 283 EXPECT_FALSE(panel_manager->ShouldBringUpTitlebarForAllMinimizedPanels( |
289 0, 0)); | 284 0, 0)); |
290 | 285 |
286 // Test that the panel in title-only state should not be minimized | |
287 // regardless the current mouse position when the panel is being dragged. | |
jennb
2011/08/17 23:01:35
s/regardless the/regardless of the
| |
288 panel1->SetExpansionState(Panel::TITLE_ONLY); | |
289 EXPECT_FALSE(panel_manager->ShouldBringUpTitlebarForAllMinimizedPanels( | |
290 0, 0)); | |
291 browser_view1->OnTitlebarMousePressed(panel1->GetBounds().origin()); | |
292 browser_view1->OnTitlebarMouseDragged( | |
293 panel1->GetBounds().origin().Subtract(gfx::Point(5, 5))); | |
294 EXPECT_TRUE(panel_manager->ShouldBringUpTitlebarForAllMinimizedPanels( | |
295 0, 0)); | |
296 browser_view1->OnTitlebarMouseReleased(); | |
297 | |
291 panel1->Close(); | 298 panel1->Close(); |
292 EXPECT_TRUE(IsMouseWatcherStarted()); | 299 EXPECT_TRUE(IsMouseWatcherStarted()); |
293 panel2->Close(); | 300 panel2->Close(); |
294 EXPECT_TRUE(IsMouseWatcherStarted()); | 301 EXPECT_TRUE(IsMouseWatcherStarted()); |
295 panel3->Close(); | 302 panel3->Close(); |
296 EXPECT_FALSE(IsMouseWatcherStarted()); | 303 EXPECT_FALSE(IsMouseWatcherStarted()); |
297 } | 304 } |
298 | 305 |
299 void TestDrawAttention() { | 306 void TestDrawAttention() { |
300 PanelBrowserView* browser_view = CreatePanelBrowserView("PanelTest", | 307 PanelBrowserView* browser_view = CreatePanelBrowserView("PanelTest", |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
399 frame_view->title_label_->x()); | 406 frame_view->title_label_->x()); |
400 EXPECT_LT(frame_view->title_label_->x() + frame_view->title_label_->width(), | 407 EXPECT_LT(frame_view->title_label_->x() + frame_view->title_label_->width(), |
401 frame_view->settings_button_->x()); | 408 frame_view->settings_button_->x()); |
402 EXPECT_LT( | 409 EXPECT_LT( |
403 frame_view->settings_button_->x() + frame_view->settings_button_->width(), | 410 frame_view->settings_button_->x() + frame_view->settings_button_->width(), |
404 frame_view->close_button_->x()); | 411 frame_view->close_button_->x()); |
405 | 412 |
406 // Validate that the controls should be updated when the activation state is | 413 // Validate that the controls should be updated when the activation state is |
407 // changed. | 414 // changed. |
408 frame_view->UpdateControlStyles(PanelBrowserFrameView::PAINT_AS_ACTIVE); | 415 frame_view->UpdateControlStyles(PanelBrowserFrameView::PAINT_AS_ACTIVE); |
409 gfx::Font title_label_font1 = frame_view->title_label_->font(); | 416 SkColor title_label_color1 = frame_view->title_label_->GetColor(); |
410 frame_view->UpdateControlStyles(PanelBrowserFrameView::PAINT_AS_INACTIVE); | 417 frame_view->UpdateControlStyles(PanelBrowserFrameView::PAINT_AS_INACTIVE); |
411 gfx::Font title_label_font2 = frame_view->title_label_->font(); | 418 SkColor title_label_color2 = frame_view->title_label_->GetColor(); |
412 EXPECT_NE(title_label_font1.GetStyle(), title_label_font2.GetStyle()); | 419 EXPECT_NE(title_label_color1, title_label_color2); |
413 | 420 |
414 browser_view->panel()->Close(); | 421 browser_view->panel()->Close(); |
415 } | 422 } |
416 | 423 |
417 IN_PROC_BROWSER_TEST_F(PanelBrowserViewTest, ShowPanelActiveOrInactive) { | 424 IN_PROC_BROWSER_TEST_F(PanelBrowserViewTest, ShowPanelActiveOrInactive) { |
418 TestShowPanelActiveOrInactive(); | 425 TestShowPanelActiveOrInactive(); |
419 } | 426 } |
420 | 427 |
421 IN_PROC_BROWSER_TEST_F(PanelBrowserViewTest, ShowOrHideSettingsButton) { | 428 IN_PROC_BROWSER_TEST_F(PanelBrowserViewTest, ShowOrHideSettingsButton) { |
422 PanelBrowserView* browser_view = CreatePanelBrowserView("PanelTest", | 429 PanelBrowserView* browser_view = CreatePanelBrowserView("PanelTest", |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
488 } | 495 } |
489 | 496 |
490 IN_PROC_BROWSER_TEST_F(PanelBrowserViewTest, MinimizeAndRestore) { | 497 IN_PROC_BROWSER_TEST_F(PanelBrowserViewTest, MinimizeAndRestore) { |
491 TestMinimizeAndRestore(); | 498 TestMinimizeAndRestore(); |
492 } | 499 } |
493 | 500 |
494 IN_PROC_BROWSER_TEST_F(PanelBrowserViewTest, DrawAttention) { | 501 IN_PROC_BROWSER_TEST_F(PanelBrowserViewTest, DrawAttention) { |
495 TestDrawAttention(); | 502 TestDrawAttention(); |
496 } | 503 } |
497 #endif | 504 #endif |
OLD | NEW |