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

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

Issue 10384192: Prevent title-only panel from fully minimizing when attention is cleared if mouse is in the panel o… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comment changed Created 8 years, 7 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/bind.h" 5 #include "base/bind.h"
6 #include "base/utf_string_conversions.h" 6 #include "base/utf_string_conversions.h"
7 #include "chrome/browser/browser_process.h" 7 #include "chrome/browser/browser_process.h"
8 #include "chrome/browser/download/download_service.h" 8 #include "chrome/browser/download/download_service.h"
9 #include "chrome/browser/download/download_service_factory.h" 9 #include "chrome/browser/download/download_service_factory.h"
10 #include "chrome/browser/net/url_request_mock_util.h" 10 #include "chrome/browser/net/url_request_mock_util.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 using content::DownloadItem; 49 using content::DownloadItem;
50 using content::DownloadManager; 50 using content::DownloadManager;
51 using content::WebContents; 51 using content::WebContents;
52 52
53 class PanelBrowserTest : public BasePanelBrowserTest { 53 class PanelBrowserTest : public BasePanelBrowserTest {
54 public: 54 public:
55 PanelBrowserTest() : BasePanelBrowserTest() { 55 PanelBrowserTest() : BasePanelBrowserTest() {
56 } 56 }
57 57
58 protected: 58 protected:
59 void MoveMouseAndWaitForExpansionStateChange(Panel* panel,
60 const gfx::Point& position) {
61 ui_test_utils::WindowedNotificationObserver signal(
62 chrome::NOTIFICATION_PANEL_CHANGED_EXPANSION_STATE,
63 content::Source<Panel>(panel));
64 MoveMouse(position);
65 signal.Wait();
66 }
67
68 // Helper function for debugging. 59 // Helper function for debugging.
69 void PrintAllPanelBounds() { 60 void PrintAllPanelBounds() {
70 const std::vector<Panel*>& panels = PanelManager::GetInstance()->panels(); 61 const std::vector<Panel*>& panels = PanelManager::GetInstance()->panels();
71 DLOG(WARNING) << "PanelBounds:"; 62 DLOG(WARNING) << "PanelBounds:";
72 for (size_t i = 0; i < panels.size(); ++i) { 63 for (size_t i = 0; i < panels.size(); ++i) {
73 DLOG(WARNING) << "#=" << i 64 DLOG(WARNING) << "#=" << i
74 << ", ptr=" << panels[i] 65 << ", ptr=" << panels[i]
75 << ", x=" << panels[i]->GetBounds().x() 66 << ", x=" << panels[i]->GetBounds().x()
76 << ", y=" << panels[i]->GetBounds().y() 67 << ", y=" << panels[i]->GetBounds().y()
77 << ", width=" << panels[i]->GetBounds().width() 68 << ", width=" << panels[i]->GetBounds().width()
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after
1070 panel1->FlashFrame(false); 1061 panel1->FlashFrame(false);
1071 EXPECT_FALSE(panel1->IsDrawingAttention()); 1062 EXPECT_FALSE(panel1->IsDrawingAttention());
1072 EXPECT_EQ(Panel::TITLE_ONLY, panel1->expansion_state()); 1063 EXPECT_EQ(Panel::TITLE_ONLY, panel1->expansion_state());
1073 1064
1074 // Move mouse away. All panels should return to minimized state. 1065 // Move mouse away. All panels should return to minimized state.
1075 hover_point.set_y(hover_point.y() - 200); 1066 hover_point.set_y(hover_point.y() - 200);
1076 MoveMouseAndWaitForExpansionStateChange(panel1, hover_point); 1067 MoveMouseAndWaitForExpansionStateChange(panel1, hover_point);
1077 EXPECT_EQ(Panel::MINIMIZED, panel1->expansion_state()); 1068 EXPECT_EQ(Panel::MINIMIZED, panel1->expansion_state());
1078 EXPECT_EQ(Panel::MINIMIZED, panel2->expansion_state()); 1069 EXPECT_EQ(Panel::MINIMIZED, panel2->expansion_state());
1079 1070
1071 // Verify minimized panel that is drawing attention stays in title-only mode
1072 // after attention is cleared if mouse is in the titlebar area.
1073 panel1->FlashFrame(true);
1074 EXPECT_TRUE(panel1->IsDrawingAttention());
1075 EXPECT_EQ(Panel::TITLE_ONLY, panel1->expansion_state());
1076
1077 gfx::Point hover_point_in_panel(panel1->GetBounds().origin());
1078 MoveMouse(hover_point_in_panel);
1079
1080 panel1->FlashFrame(false);
1081 EXPECT_FALSE(panel1->IsDrawingAttention());
1082 EXPECT_EQ(Panel::TITLE_ONLY, panel1->expansion_state());
1083 EXPECT_EQ(Panel::MINIMIZED, panel2->expansion_state());
1084
1085 // Move mouse away and panel should go back to fully minimized state.
1086 MoveMouseAndWaitForExpansionStateChange(panel1, hover_point);
1087 EXPECT_EQ(Panel::MINIMIZED, panel1->expansion_state());
1088 EXPECT_EQ(Panel::MINIMIZED, panel2->expansion_state());
1089
1080 panel1->Close(); 1090 panel1->Close();
1081 panel2->Close(); 1091 panel2->Close();
1082 } 1092 }
1083 1093
1084 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, DrawAttentionWhenActive) { 1094 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, DrawAttentionWhenActive) {
1085 CreatePanelParams params("Initially Active", gfx::Rect(), SHOW_AS_ACTIVE); 1095 CreatePanelParams params("Initially Active", gfx::Rect(), SHOW_AS_ACTIVE);
1086 Panel* panel = CreatePanelWithParams(params); 1096 Panel* panel = CreatePanelWithParams(params);
1087 scoped_ptr<NativePanelTesting> native_panel_testing( 1097 scoped_ptr<NativePanelTesting> native_panel_testing(
1088 NativePanelTesting::Create(panel->native_panel())); 1098 NativePanelTesting::Create(panel->native_panel()));
1089 1099
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after
1897 // position when tall panel brings up its titlebar. 1907 // position when tall panel brings up its titlebar.
1898 CloseWindowAndWait(panel1->browser()); 1908 CloseWindowAndWait(panel1->browser());
1899 EXPECT_EQ(balloon_bottom_after_tall_panel_titlebar_up, 1909 EXPECT_EQ(balloon_bottom_after_tall_panel_titlebar_up,
1900 GetBalloonBottomPosition(balloon)); 1910 GetBalloonBottomPosition(balloon));
1901 1911
1902 // Closing the remaining tall panel should move the notification balloon back 1912 // Closing the remaining tall panel should move the notification balloon back
1903 // to its original position. 1913 // to its original position.
1904 CloseWindowAndWait(panel2->browser()); 1914 CloseWindowAndWait(panel2->browser());
1905 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon)); 1915 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon));
1906 } 1916 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/docked_panel_strip.cc ('k') | chrome/browser/ui/panels/panel_drag_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698