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

Side by Side Diff: ash/shelf/shelf_layout_manager_unittest.cc

Issue 15718003: Add SessionStateObserver with ActiveUserChanged() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge & reviews Created 7 years, 6 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 "ash/shelf/shelf_layout_manager.h" 5 #include "ash/shelf/shelf_layout_manager.h"
6 6
7 #include "ash/accelerators/accelerator_controller.h" 7 #include "ash/accelerators/accelerator_controller.h"
8 #include "ash/accelerators/accelerator_table.h" 8 #include "ash/accelerators/accelerator_table.h"
9 #include "ash/ash_switches.h" 9 #include "ash/ash_switches.h"
10 #include "ash/display/display_manager.h" 10 #include "ash/display/display_manager.h"
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1239 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); 1239 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
1240 EXPECT_FALSE(tray->HasSystemBubble()); 1240 EXPECT_FALSE(tray->HasSystemBubble());
1241 1241
1242 // Now, drag up on the tray to show the bubble. 1242 // Now, drag up on the tray to show the bubble.
1243 gfx::Point start = GetShelfWidget()->status_area_widget()-> 1243 gfx::Point start = GetShelfWidget()->status_area_widget()->
1244 GetWindowBoundsInScreen().CenterPoint(); 1244 GetWindowBoundsInScreen().CenterPoint();
1245 gfx::Point end(start.x(), start.y() - 100); 1245 gfx::Point end(start.x(), start.y() - 100);
1246 generator.GestureScrollSequence(start, end, 1246 generator.GestureScrollSequence(start, end,
1247 base::TimeDelta::FromMilliseconds(10), 1); 1247 base::TimeDelta::FromMilliseconds(10), 1);
1248 EXPECT_TRUE(tray->HasSystemBubble()); 1248 EXPECT_TRUE(tray->HasSystemBubble());
1249 tray->CloseSystemBubbleForTest(); 1249 tray->CloseSystemBubble();
1250 RunAllPendingInMessageLoop(); 1250 RunAllPendingInMessageLoop();
1251 EXPECT_FALSE(tray->HasSystemBubble()); 1251 EXPECT_FALSE(tray->HasSystemBubble());
1252 1252
1253 // Drag again, but only a small amount, and slowly. The bubble should not be 1253 // Drag again, but only a small amount, and slowly. The bubble should not be
1254 // visible. 1254 // visible.
1255 end.set_y(start.y() - 30); 1255 end.set_y(start.y() - 30);
1256 generator.GestureScrollSequence(start, end, 1256 generator.GestureScrollSequence(start, end,
1257 base::TimeDelta::FromMilliseconds(500), 100); 1257 base::TimeDelta::FromMilliseconds(500), 100);
1258 EXPECT_FALSE(tray->HasSystemBubble()); 1258 EXPECT_FALSE(tray->HasSystemBubble());
1259 1259
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1406 // allow auto hide. 1406 // allow auto hide.
1407 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); 1407 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
1408 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown()); 1408 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown());
1409 gfx::Point center = 1409 gfx::Point center =
1410 status_area_widget->GetWindowBoundsInScreen().CenterPoint(); 1410 status_area_widget->GetWindowBoundsInScreen().CenterPoint();
1411 generator.MoveMouseTo(center.x(), center.y()); 1411 generator.MoveMouseTo(center.x(), center.y());
1412 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); 1412 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
1413 EXPECT_TRUE(shelf->IsVisible()); 1413 EXPECT_TRUE(shelf->IsVisible());
1414 if (!i) { 1414 if (!i) {
1415 // In our first iteration we make sure there is no bubble. 1415 // In our first iteration we make sure there is no bubble.
1416 tray->CloseSystemBubbleForTest(); 1416 tray->CloseSystemBubble();
1417 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown()); 1417 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown());
1418 } else { 1418 } else {
1419 // In our second iteration we show a bubble. 1419 // In our second iteration we show a bubble.
1420 TestItem *item = new TestItem; 1420 TestItem *item = new TestItem;
1421 tray->AddTrayItem(item); 1421 tray->AddTrayItem(item);
1422 tray->ShowNotificationView(item); 1422 tray->ShowNotificationView(item);
1423 EXPECT_TRUE(status_area_widget->IsMessageBubbleShown()); 1423 EXPECT_TRUE(status_area_widget->IsMessageBubbleShown());
1424 } 1424 }
1425 // Move the pointer over the edge of the shelf. 1425 // Move the pointer over the edge of the shelf.
1426 generator.MoveMouseTo( 1426 generator.MoveMouseTo(
1427 center.x(), status_area_widget->GetWindowBoundsInScreen().y() - 8); 1427 center.x(), status_area_widget->GetWindowBoundsInScreen().y() - 8);
1428 shelf->UpdateVisibilityState(); 1428 shelf->UpdateVisibilityState();
1429 if (i) { 1429 if (i) {
1430 EXPECT_TRUE(shelf->IsVisible()); 1430 EXPECT_TRUE(shelf->IsVisible());
1431 EXPECT_TRUE(status_area_widget->IsMessageBubbleShown()); 1431 EXPECT_TRUE(status_area_widget->IsMessageBubbleShown());
1432 } else { 1432 } else {
1433 EXPECT_FALSE(shelf->IsVisible()); 1433 EXPECT_FALSE(shelf->IsVisible());
1434 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown()); 1434 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown());
1435 } 1435 }
1436 } 1436 }
1437 } 1437 }
1438 1438
1439 } // namespace internal 1439 } // namespace internal
1440 } // namespace ash 1440 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698