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

Side by Side Diff: ash/display/display_manager_unittest.cc

Issue 11801019: Merge 174008 (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1364/src/
Patch Set: Created 7 years, 11 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
« no previous file with comments | « ash/display/display_controller.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/display/display_manager.h" 5 #include "ash/display/display_manager.h"
6 6
7 #include "ash/display/display_controller.h" 7 #include "ash/display/display_controller.h"
8 #include "ash/screen_ash.h" 8 #include "ash/screen_ash.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/test/ash_test_base.h" 10 #include "ash/test/ash_test_base.h"
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 display_manager()->OnNativeDisplaysChanged(displays); 385 display_manager()->OnNativeDisplaysChanged(displays);
386 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); 386 EXPECT_EQ(2U, display_manager()->GetNumDisplays());
387 387
388 // and resume with different external display. 388 // and resume with different external display.
389 displays.push_back(native_display); 389 displays.push_back(native_display);
390 displays.push_back(gfx::Display(11, gfx::Rect(1, 1, 100, 100))); 390 displays.push_back(gfx::Display(11, gfx::Rect(1, 1, 100, 100)));
391 display_manager()->OnNativeDisplaysChanged(displays); 391 display_manager()->OnNativeDisplaysChanged(displays);
392 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); 392 EXPECT_EQ(2U, display_manager()->GetNumDisplays());
393 } 393 }
394 394
395 TEST_F(DisplayManagerTest, TestNativeDisplaysChangedNoInternal) {
396 EXPECT_EQ(1U, display_manager()->GetNumDisplays());
397
398 // Don't change the display info if all displays are disconnected.
399 std::vector<gfx::Display> displays;
400 display_manager()->OnNativeDisplaysChanged(displays);
401 EXPECT_EQ(1U, display_manager()->GetNumDisplays());
402
403 // Connect another display which will become primary.
404 const gfx::Display external_display(10, gfx::Rect(1, 1, 100, 100));
405 displays.push_back(external_display);
406 display_manager()->OnNativeDisplaysChanged(displays);
407 EXPECT_EQ(1U, display_manager()->GetNumDisplays());
408 EXPECT_EQ("1,1 100x100",
409 FindDisplayForId(10).bounds_in_pixel().ToString());
410 }
411
395 TEST_F(DisplayManagerTest, EnsurePointerInDisplays) { 412 TEST_F(DisplayManagerTest, EnsurePointerInDisplays) {
396 UpdateDisplay("200x200,300x300"); 413 UpdateDisplay("200x200,300x300");
397 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 414 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
398 415
399 aura::Env* env = aura::Env::GetInstance(); 416 aura::Env* env = aura::Env::GetInstance();
400 417
401 // Set the initial position. 418 // Set the initial position.
402 root_windows[0]->MoveCursorTo(gfx::Point(350, 150)); 419 root_windows[0]->MoveCursorTo(gfx::Point(350, 150));
403 EXPECT_EQ("350,150", env->last_mouse_location().ToString()); 420 EXPECT_EQ("350,150", env->last_mouse_location().ToString());
404 421
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 // OnNativeDisplaysChanged may change the display bounds. Here makes sure 507 // OnNativeDisplaysChanged may change the display bounds. Here makes sure
491 // nothing changed if the exactly same displays are specified. 508 // nothing changed if the exactly same displays are specified.
492 display_manager()->OnNativeDisplaysChanged(displays); 509 display_manager()->OnNativeDisplaysChanged(displays);
493 EXPECT_EQ("-500,0 500x500", 510 EXPECT_EQ("-500,0 500x500",
494 FindDisplayForId(internal_display_id).bounds().ToString()); 511 FindDisplayForId(internal_display_id).bounds().ToString());
495 EXPECT_EQ("0,0 100x100", FindDisplayForId(10).bounds().ToString()); 512 EXPECT_EQ("0,0 100x100", FindDisplayForId(10).bounds().ToString());
496 } 513 }
497 514
498 } // namespace internal 515 } // namespace internal
499 } // namespace ash 516 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/display_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698