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

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

Issue 10836159: Fix bug 141013: OldPanelBrowserTest.CheckDockedPanelProperties is flaky (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix per feedback Created 8 years, 4 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/utf_string_conversions.h" 5 #include "base/utf_string_conversions.h"
6 #include "chrome/browser/browser_process.h" 6 #include "chrome/browser/browser_process.h"
7 #include "chrome/browser/notifications/balloon.h" 7 #include "chrome/browser/notifications/balloon.h"
8 #include "chrome/browser/notifications/balloon_collection_impl.h" 8 #include "chrome/browser/notifications/balloon_collection_impl.h"
9 #include "chrome/browser/notifications/desktop_notification_service.h" 9 #include "chrome/browser/notifications/desktop_notification_service.h"
10 #include "chrome/browser/notifications/notification.h" 10 #include "chrome/browser/notifications/notification.h"
11 #include "chrome/browser/notifications/notification_ui_manager.h" 11 #include "chrome/browser/notifications/notification_ui_manager.h"
12 #include "chrome/browser/prefs/pref_service.h" 12 #include "chrome/browser/prefs/pref_service.h"
13 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
14 #include "chrome/browser/ui/panels/base_panel_browser_test.h" 14 #include "chrome/browser/ui/panels/base_panel_browser_test.h"
15 #include "chrome/browser/ui/panels/panel.h" 15 #include "chrome/browser/ui/panels/panel.h"
16 #include "chrome/browser/ui/panels/panel_manager.h" 16 #include "chrome/browser/ui/panels/panel_manager.h"
17 #include "chrome/browser/ui/panels/test_panel_mouse_watcher.h"
18 #include "chrome/common/pref_names.h" 17 #include "chrome/common/pref_names.h"
19 #include "content/public/common/show_desktop_notification_params.h" 18 #include "content/public/common/show_desktop_notification_params.h"
20 #include "ui/gfx/screen.h" 19 #include "ui/gfx/screen.h"
21 20
22 21
23 // Refactor has only been done for Win and Mac panels so far. 22 // Refactor has only been done for Win and Mac panels so far.
24 #if defined(OS_WIN) || defined(OS_MACOSX) 23 #if defined(OS_WIN) || defined(OS_MACOSX)
25 24
26 // Desktop notification code subscribes to various panel change notifications 25 // Desktop notification code subscribes to various panel change notifications
27 // so that it knows when to adjusts balloon positions. In order to give 26 // so that it knows when to adjusts balloon positions. In order to give
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 137
139 // Close the panel. Expect the notification balloon moves back to its original 138 // Close the panel. Expect the notification balloon moves back to its original
140 // position. 139 // position.
141 panel->Close(); 140 panel->Close();
142 MessageLoopForUI::current()->RunAllPending(); 141 MessageLoopForUI::current()->RunAllPending();
143 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon)); 142 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon));
144 } 143 }
145 144
146 IN_PROC_BROWSER_TEST_F(PanelAndDesktopNotificationTest, 145 IN_PROC_BROWSER_TEST_F(PanelAndDesktopNotificationTest,
147 ExpandAndCollapsePanel) { 146 ExpandAndCollapsePanel) {
148 // Disable mouse watcher since we don't want mouse movements to affect panel
149 // testing for title-only state.
150 PanelManager* panel_manager = PanelManager::GetInstance();
151 PanelMouseWatcher* mouse_watcher = new TestPanelMouseWatcher();
152 panel_manager->SetMouseWatcherForTesting(mouse_watcher);
153
154 Balloon* balloon = CreateBalloon(); 147 Balloon* balloon = CreateBalloon();
155 148
156 // Create a docked panel. Expect that the notification balloon moves up to be 149 // Create a docked panel. Expect that the notification balloon moves up to be
157 // above the panel. 150 // above the panel.
158 Panel* panel = CreateDockedPanel("1", gfx::Rect(0, 0, 200, 200)); 151 Panel* panel = CreateDockedPanel("1", gfx::Rect(0, 0, 200, 200));
159 MessageLoopForUI::current()->RunAllPending(); 152 MessageLoopForUI::current()->RunAllPending();
160 int balloon_bottom_on_expanded = GetBalloonBottomPosition(balloon); 153 int balloon_bottom_on_expanded = GetBalloonBottomPosition(balloon);
161 EXPECT_LT(balloon_bottom_on_expanded, panel->GetBounds().y()); 154 EXPECT_LT(balloon_bottom_on_expanded, panel->GetBounds().y());
162 155
163 // Minimize the panel. Expect that the notification balloon moves down, but 156 // Minimize the panel. Expect that the notification balloon moves down, but
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 GetBalloonBottomPosition(balloon)); 398 GetBalloonBottomPosition(balloon));
406 399
407 // Close short panel. Expect that the notification balloo moves back to its 400 // Close short panel. Expect that the notification balloo moves back to its
408 // original position. 401 // original position.
409 short_panel->Close(); 402 short_panel->Close();
410 MessageLoopForUI::current()->RunAllPending(); 403 MessageLoopForUI::current()->RunAllPending();
411 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon)); 404 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon));
412 } 405 }
413 406
414 #endif // OS_WIN || OS_MACOSX 407 #endif // OS_WIN || OS_MACOSX
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/old_panel_drag_browsertest.cc ('k') | chrome/browser/ui/panels/panel_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698