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

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

Issue 7977037: Refactor Win panel mouse watcher to use PanelMouseWatcher base class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 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) 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"
11 #include "chrome/browser/ui/panels/panel.h" 11 #include "chrome/browser/ui/panels/panel.h"
12 #include "chrome/browser/ui/panels/panel_browser_frame_view.h" 12 #include "chrome/browser/ui/panels/panel_browser_frame_view.h"
13 #include "chrome/browser/ui/panels/panel_browser_view.h" 13 #include "chrome/browser/ui/panels/panel_browser_view.h"
14 #include "chrome/browser/ui/panels/panel_manager.h" 14 #include "chrome/browser/ui/panels/panel_manager.h"
15 #include "chrome/browser/ui/panels/panel_mouse_watcher_win.h" 15 #include "chrome/browser/ui/panels/panel_mouse_watcher.h"
16 #include "chrome/browser/web_applications/web_app.h" 16 #include "chrome/browser/web_applications/web_app.h"
17 #include "chrome/common/chrome_switches.h" 17 #include "chrome/common/chrome_switches.h"
18 #include "chrome/common/extensions/extension.h" 18 #include "chrome/common/extensions/extension.h"
19 #include "grit/generated_resources.h" 19 #include "grit/generated_resources.h"
20 #include "ui/base/l10n/l10n_util.h" 20 #include "ui/base/l10n/l10n_util.h"
21 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
22 #include "ui/base/animation/slide_animation.h" 22 #include "ui/base/animation/slide_animation.h"
23 #include "views/controls/button/image_button.h" 23 #include "views/controls/button/image_button.h"
24 #include "views/controls/button/menu_button.h" 24 #include "views/controls/button/menu_button.h"
25 #include "views/controls/image_view.h" 25 #include "views/controls/image_view.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 // Test minimizing/restoring an individual panel. 119 // Test minimizing/restoring an individual panel.
120 EXPECT_EQ(Panel::EXPANDED, panel1->expansion_state()); 120 EXPECT_EQ(Panel::EXPANDED, panel1->expansion_state());
121 int initial_height = panel1->GetBounds().height(); 121 int initial_height = panel1->GetBounds().height();
122 int titlebar_height = frame_view1->NonClientTopBorderHeight(); 122 int titlebar_height = frame_view1->NonClientTopBorderHeight();
123 123
124 panel1->SetExpansionState(Panel::MINIMIZED); 124 panel1->SetExpansionState(Panel::MINIMIZED);
125 EXPECT_EQ(Panel::MINIMIZED, panel1->expansion_state()); 125 EXPECT_EQ(Panel::MINIMIZED, panel1->expansion_state());
126 EXPECT_LT(panel1->GetBounds().height(), titlebar_height); 126 EXPECT_LT(panel1->GetBounds().height(), titlebar_height);
127 EXPECT_GT(panel1->GetBounds().height(), 0); 127 EXPECT_GT(panel1->GetBounds().height(), 0);
128 EXPECT_EQ(expected_bottom_on_minimized, panel1->GetBounds().bottom()); 128 EXPECT_EQ(expected_bottom_on_minimized, panel1->GetBounds().bottom());
129 EXPECT_TRUE(IsMouseWatcherStarted()); 129 EXPECT_TRUE(PanelMouseWatcher::GetInstance()->IsSubscribed(browser_view1));
130 WaitTillBoundsAnimationFinished(browser_view1); 130 WaitTillBoundsAnimationFinished(browser_view1);
131 EXPECT_FALSE(panel1->IsActive()); 131 EXPECT_FALSE(panel1->IsActive());
132 132
133 panel1->SetExpansionState(Panel::TITLE_ONLY); 133 panel1->SetExpansionState(Panel::TITLE_ONLY);
134 EXPECT_EQ(Panel::TITLE_ONLY, panel1->expansion_state()); 134 EXPECT_EQ(Panel::TITLE_ONLY, panel1->expansion_state());
135 EXPECT_EQ(titlebar_height, panel1->GetBounds().height()); 135 EXPECT_EQ(titlebar_height, panel1->GetBounds().height());
136 EXPECT_EQ(expected_bottom_on_unminimized, panel1->GetBounds().bottom()); 136 EXPECT_EQ(expected_bottom_on_unminimized, panel1->GetBounds().bottom());
137 WaitTillBoundsAnimationFinished(browser_view1); 137 WaitTillBoundsAnimationFinished(browser_view1);
138 EXPECT_TRUE(frame_view1->close_button_->IsVisible()); 138 EXPECT_TRUE(frame_view1->close_button_->IsVisible());
139 EXPECT_TRUE(frame_view1->title_icon_->IsVisible()); 139 EXPECT_TRUE(frame_view1->title_icon_->IsVisible());
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 EXPECT_FALSE(panel_manager->ShouldBringUpTitlebars( 202 EXPECT_FALSE(panel_manager->ShouldBringUpTitlebars(
203 0, 0)); 203 0, 0));
204 browser_view1->OnTitlebarMousePressed(panel1->GetBounds().origin()); 204 browser_view1->OnTitlebarMousePressed(panel1->GetBounds().origin());
205 browser_view1->OnTitlebarMouseDragged( 205 browser_view1->OnTitlebarMouseDragged(
206 panel1->GetBounds().origin().Subtract(gfx::Point(5, 5))); 206 panel1->GetBounds().origin().Subtract(gfx::Point(5, 5)));
207 EXPECT_TRUE(panel_manager->ShouldBringUpTitlebars( 207 EXPECT_TRUE(panel_manager->ShouldBringUpTitlebars(
208 0, 0)); 208 0, 0));
209 browser_view1->OnTitlebarMouseReleased(); 209 browser_view1->OnTitlebarMouseReleased();
210 210
211 panel1->Close(); 211 panel1->Close();
212 EXPECT_TRUE(IsMouseWatcherStarted());
213 panel2->Close(); 212 panel2->Close();
214 EXPECT_TRUE(IsMouseWatcherStarted());
215 panel3->Close(); 213 panel3->Close();
216 EXPECT_FALSE(IsMouseWatcherStarted());
217 } 214 }
218 215
219 void TestDrawAttention() { 216 void TestDrawAttention() {
220 Panel* panel = CreatePanel("PanelTest"); 217 Panel* panel = CreatePanel("PanelTest");
221 PanelBrowserView* browser_view = GetBrowserView(panel); 218 PanelBrowserView* browser_view = GetBrowserView(panel);
222 PanelBrowserFrameView* frame_view = browser_view->GetFrameView(); 219 PanelBrowserFrameView* frame_view = browser_view->GetFrameView();
223 SkColor attention_color = frame_view->GetTitleColor( 220 SkColor attention_color = frame_view->GetTitleColor(
224 PanelBrowserFrameView::PAINT_FOR_ATTENTION); 221 PanelBrowserFrameView::PAINT_FOR_ATTENTION);
225 222
226 // Test that the attention should not be drawn if the expanded panel is in 223 // Test that the attention should not be drawn if the expanded panel is in
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 444
448 // TODO(jianli): Investigate why this fails on win trunk build. 445 // TODO(jianli): Investigate why this fails on win trunk build.
449 IN_PROC_BROWSER_TEST_F(PanelBrowserViewTest, DISABLED_DrawAttention) { 446 IN_PROC_BROWSER_TEST_F(PanelBrowserViewTest, DISABLED_DrawAttention) {
450 TestDrawAttention(); 447 TestDrawAttention();
451 } 448 }
452 449
453 IN_PROC_BROWSER_TEST_F(PanelBrowserViewTest, ChangeAutoHideTaskBarThickness) { 450 IN_PROC_BROWSER_TEST_F(PanelBrowserViewTest, ChangeAutoHideTaskBarThickness) {
454 TestChangeAutoHideTaskBarThickness(); 451 TestChangeAutoHideTaskBarThickness();
455 } 452 }
456 #endif 453 #endif
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/panel_browser_view.cc ('k') | chrome/browser/ui/panels/panel_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698