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

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

Issue 11428066: Use WS_POPUP for ash_unittests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years 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_unittest.cc ('k') | ash/extended_desktop_unittest.cc » ('j') | 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 88
89 private: 89 private:
90 vector<gfx::Display> changed_; 90 vector<gfx::Display> changed_;
91 vector<gfx::Display> added_; 91 vector<gfx::Display> added_;
92 size_t removed_count_; 92 size_t removed_count_;
93 bool root_window_destroyed_; 93 bool root_window_destroyed_;
94 94
95 DISALLOW_COPY_AND_ASSIGN(DisplayManagerTest); 95 DISALLOW_COPY_AND_ASSIGN(DisplayManagerTest);
96 }; 96 };
97 97
98 #if defined(OS_CHROMEOS) 98 TEST_F(DisplayManagerTest, NativeDisplayTest) {
99 // TODO(oshima): This fails with non extended desktop on windows.
100 // Reenable when extended desktop is enabled by default.
101 #define MAYBE_NativeDisplayTest NativeDisplayTest
102 #define MAYBE_EmulatorTest EmulatorTest
103 #define MAYBE_OverscanInsetsTest OverscanInsetsTest
104 #define MAYBE_ZeroOverscanInsets ZeroOverscanInsets
105 #else
106 #define MAYBE_NativeDisplayTest DISABLED_NativeDisplayTest
107 #define MAYBE_EmulatorTest DISABLED_EmulatorTest
108 #define MAYBE_OverscanInsetsTest DISABLED_OverscanInsetsTest
109 #define MAYBE_ZeroOverscanInsets DISABLED_ZeroOverscanInsets
110 #endif
111
112 TEST_F(DisplayManagerTest, MAYBE_NativeDisplayTest) {
113 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); 99 EXPECT_EQ(1U, display_manager()->GetNumDisplays());
114 100
115 // Update primary and add seconary. 101 // Update primary and add seconary.
116 UpdateDisplay("100+0-500x500,0+501-400x400"); 102 UpdateDisplay("100+0-500x500,0+501-400x400");
117 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); 103 EXPECT_EQ(2U, display_manager()->GetNumDisplays());
118 EXPECT_EQ("0,0 500x500", 104 EXPECT_EQ("0,0 500x500",
119 display_manager()->GetDisplayAt(0)->bounds().ToString()); 105 display_manager()->GetDisplayAt(0)->bounds().ToString());
120 106
121 EXPECT_EQ("1 1 0", GetCountSummary()); 107 EXPECT_EQ("1 1 0", GetCountSummary());
122 EXPECT_EQ(display_manager()->GetDisplayAt(0)->id(), changed()[0].id()); 108 EXPECT_EQ(display_manager()->GetDisplayAt(0)->id(), changed()[0].id());
123 EXPECT_EQ(display_manager()->GetDisplayAt(1)->id(), added()[0].id()); 109 EXPECT_EQ(display_manager()->GetDisplayAt(1)->id(), added()[0].id());
124 EXPECT_EQ("0,0 500x500", changed()[0].bounds().ToString()); 110 EXPECT_EQ("0,0 500x500", changed()[0].bounds().ToString());
125 // Secondary display is on right. 111 // Secondary display is on right.
126 EXPECT_EQ("500,0 400x400", added()[0].bounds().ToString()); 112 EXPECT_EQ("500,0 400x400", added()[0].bounds().ToString());
127 EXPECT_EQ("0,501 400x400", added()[0].bounds_in_pixel().ToString()); 113 EXPECT_EQ("0,501 400x400", added()[0].bounds_in_pixel().ToString());
128 reset(); 114 reset();
129 115
130 // Delete secondary. 116 // Delete secondary.
131 UpdateDisplay("100+0-500x500"); 117 UpdateDisplay("100+0-500x500");
132 EXPECT_EQ("0 0 1", GetCountSummary()); 118 EXPECT_EQ("0 0 1", GetCountSummary());
133 reset(); 119 reset();
134 120
135 // Change primary. 121 // Change primary.
136 UpdateDisplay("0+0-1000x600"); 122 UpdateDisplay("1+1-1000x600");
137 EXPECT_EQ("1 0 0", GetCountSummary()); 123 EXPECT_EQ("1 0 0", GetCountSummary());
138 EXPECT_EQ(display_manager()->GetDisplayAt(0)->id(), changed()[0].id()); 124 EXPECT_EQ(display_manager()->GetDisplayAt(0)->id(), changed()[0].id());
139 EXPECT_EQ("0,0 1000x600", changed()[0].bounds().ToString()); 125 EXPECT_EQ("0,0 1000x600", changed()[0].bounds().ToString());
140 reset(); 126 reset();
141 127
142 // Add secondary. 128 // Add secondary.
143 UpdateDisplay("0+0-1000x600,1001+0-600x400"); 129 UpdateDisplay("1+1-1000x600,1002+0-600x400");
144 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); 130 EXPECT_EQ(2U, display_manager()->GetNumDisplays());
145 EXPECT_EQ("0 1 0", GetCountSummary()); 131 EXPECT_EQ("0 1 0", GetCountSummary());
146 EXPECT_EQ(display_manager()->GetDisplayAt(1)->id(), added()[0].id()); 132 EXPECT_EQ(display_manager()->GetDisplayAt(1)->id(), added()[0].id());
147 // Secondary display is on right. 133 // Secondary display is on right.
148 EXPECT_EQ("1000,0 600x400", added()[0].bounds().ToString()); 134 EXPECT_EQ("1000,0 600x400", added()[0].bounds().ToString());
149 EXPECT_EQ("1001,0 600x400", added()[0].bounds_in_pixel().ToString()); 135 EXPECT_EQ("1002,0 600x400", added()[0].bounds_in_pixel().ToString());
150 reset(); 136 reset();
151 137
152 // Secondary removed, primary changed. 138 // Secondary removed, primary changed.
153 UpdateDisplay("0+0-800x300"); 139 UpdateDisplay("1+1-800x300");
154 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); 140 EXPECT_EQ(1U, display_manager()->GetNumDisplays());
155 EXPECT_EQ("1 0 1", GetCountSummary()); 141 EXPECT_EQ("1 0 1", GetCountSummary());
156 EXPECT_EQ(display_manager()->GetDisplayAt(0)->id(), changed()[0].id()); 142 EXPECT_EQ(display_manager()->GetDisplayAt(0)->id(), changed()[0].id());
157 EXPECT_EQ("0,0 800x300", changed()[0].bounds().ToString()); 143 EXPECT_EQ("0,0 800x300", changed()[0].bounds().ToString());
158 reset(); 144 reset();
159 145
160 // # of display can go to zero when screen is off. 146 // # of display can go to zero when screen is off.
161 const vector<gfx::Display> empty; 147 const vector<gfx::Display> empty;
162 display_manager()->OnNativeDisplaysChanged(empty); 148 display_manager()->OnNativeDisplaysChanged(empty);
163 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); 149 EXPECT_EQ(1U, display_manager()->GetNumDisplays());
(...skipping 26 matching lines...) Expand all
190 display_manager()->GetDisplayAt(0)->bounds().ToString()); 176 display_manager()->GetDisplayAt(0)->bounds().ToString());
191 // Secondary display is on right. 177 // Secondary display is on right.
192 EXPECT_EQ("1000,0 600x400", 178 EXPECT_EQ("1000,0 600x400",
193 display_manager()->GetDisplayAt(1)->bounds().ToString()); 179 display_manager()->GetDisplayAt(1)->bounds().ToString());
194 EXPECT_EQ("1000,1000 600x400", 180 EXPECT_EQ("1000,1000 600x400",
195 display_manager()->GetDisplayAt(1)->bounds_in_pixel().ToString()); 181 display_manager()->GetDisplayAt(1)->bounds_in_pixel().ToString());
196 reset(); 182 reset();
197 } 183 }
198 184
199 // Test in emulation mode (use_fullscreen_host_window=false) 185 // Test in emulation mode (use_fullscreen_host_window=false)
200 TEST_F(DisplayManagerTest, MAYBE_EmulatorTest) { 186 TEST_F(DisplayManagerTest, EmulatorTest) {
201 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); 187 EXPECT_EQ(1U, display_manager()->GetNumDisplays());
202 188
203 DisplayManager::CycleDisplay(); 189 DisplayManager::CycleDisplay();
204 // Update primary and add seconary. 190 // Update primary and add seconary.
205 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); 191 EXPECT_EQ(2U, display_manager()->GetNumDisplays());
206 EXPECT_EQ("0 1 0", GetCountSummary()); 192 EXPECT_EQ("0 1 0", GetCountSummary());
207 reset(); 193 reset();
208 194
209 DisplayManager::CycleDisplay(); 195 DisplayManager::CycleDisplay();
210 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); 196 EXPECT_EQ(1U, display_manager()->GetNumDisplays());
211 EXPECT_EQ("0 0 1", GetCountSummary()); 197 EXPECT_EQ("0 0 1", GetCountSummary());
212 reset(); 198 reset();
213 199
214 DisplayManager::CycleDisplay(); 200 DisplayManager::CycleDisplay();
215 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); 201 EXPECT_EQ(2U, display_manager()->GetNumDisplays());
216 EXPECT_EQ("0 1 0", GetCountSummary()); 202 EXPECT_EQ("0 1 0", GetCountSummary());
217 reset(); 203 reset();
218 } 204 }
219 205
220 TEST_F(DisplayManagerTest, MAYBE_OverscanInsetsTest) { 206 TEST_F(DisplayManagerTest, OverscanInsetsTest) {
221 UpdateDisplay("0+0-500x500,0+501-400x400"); 207 UpdateDisplay("0+0-500x500,0+501-400x400");
222 reset(); 208 reset();
223 ASSERT_EQ(2u, display_manager()->GetNumDisplays()); 209 ASSERT_EQ(2u, display_manager()->GetNumDisplays());
224 gfx::Display display1(*display_manager()->GetDisplayAt(0)); 210 gfx::Display display1(*display_manager()->GetDisplayAt(0));
225 gfx::Display display2(*display_manager()->GetDisplayAt(1)); 211 gfx::Display display2(*display_manager()->GetDisplayAt(1));
226 212
227 display_manager()->SetOverscanInsets( 213 display_manager()->SetOverscanInsets(
228 display2.id(), gfx::Insets(13, 12, 11, 10)); 214 display2.id(), gfx::Insets(13, 12, 11, 10));
229 std::vector<gfx::Display> changed_displays = changed(); 215 std::vector<gfx::Display> changed_displays = changed();
230 EXPECT_EQ(1u, changed_displays.size()); 216 EXPECT_EQ(1u, changed_displays.size());
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 270
285 // Make sure switching primary display applies the overscan offset only once. 271 // Make sure switching primary display applies the overscan offset only once.
286 ash::Shell::GetInstance()->display_controller()->SetPrimaryDisplay( 272 ash::Shell::GetInstance()->display_controller()->SetPrimaryDisplay(
287 ScreenAsh::GetSecondaryDisplay()); 273 ScreenAsh::GetSecondaryDisplay());
288 EXPECT_EQ("0,0 500x500", 274 EXPECT_EQ("0,0 500x500",
289 ScreenAsh::GetSecondaryDisplay().bounds_in_pixel().ToString()); 275 ScreenAsh::GetSecondaryDisplay().bounds_in_pixel().ToString());
290 EXPECT_EQ("10,509 376x380", gfx::Screen::GetNativeScreen()-> 276 EXPECT_EQ("10,509 376x380", gfx::Screen::GetNativeScreen()->
291 GetPrimaryDisplay().bounds_in_pixel().ToString()); 277 GetPrimaryDisplay().bounds_in_pixel().ToString());
292 } 278 }
293 279
294 TEST_F(DisplayManagerTest, MAYBE_ZeroOverscanInsets) { 280 TEST_F(DisplayManagerTest, ZeroOverscanInsets) {
295 // Make sure the display change events is emitted for overscan inset changes. 281 // Make sure the display change events is emitted for overscan inset changes.
296 UpdateDisplay("0+0-500x500,0+501-400x400"); 282 UpdateDisplay("0+0-500x500,0+501-400x400");
297 ASSERT_EQ(2u, display_manager()->GetNumDisplays()); 283 ASSERT_EQ(2u, display_manager()->GetNumDisplays());
298 int64 display2_id = display_manager()->GetDisplayAt(1)->id(); 284 int64 display2_id = display_manager()->GetDisplayAt(1)->id();
299 285
300 reset(); 286 reset();
301 display_manager()->SetOverscanInsets(display2_id, gfx::Insets(0, 0, 0, 0)); 287 display_manager()->SetOverscanInsets(display2_id, gfx::Insets(0, 0, 0, 0));
302 EXPECT_EQ(0u, changed().size()); 288 EXPECT_EQ(0u, changed().size());
303 289
304 reset(); 290 reset();
305 display_manager()->SetOverscanInsets(display2_id, gfx::Insets(1, 0, 0, 0)); 291 display_manager()->SetOverscanInsets(display2_id, gfx::Insets(1, 0, 0, 0));
306 EXPECT_EQ(1u, changed().size()); 292 EXPECT_EQ(1u, changed().size());
307 EXPECT_EQ(display2_id, changed()[0].id()); 293 EXPECT_EQ(display2_id, changed()[0].id());
308 294
309 reset(); 295 reset();
310 display_manager()->SetOverscanInsets(display2_id, gfx::Insets(0, 0, 0, 0)); 296 display_manager()->SetOverscanInsets(display2_id, gfx::Insets(0, 0, 0, 0));
311 EXPECT_EQ(1u, changed().size()); 297 EXPECT_EQ(1u, changed().size());
312 EXPECT_EQ(display2_id, changed()[0].id()); 298 EXPECT_EQ(display2_id, changed()[0].id());
313 } 299 }
314 300
315 // TODO(oshima): Device scale factor is supported on chromeos only for now. 301 TEST_F(DisplayManagerTest, TestDeviceScaleOnlyChange) {
316 #if defined(OS_CHROMEOS)
317 #define MAYBE_TestDeviceScaleOnlyChange TestDeviceScaleOnlyChange
318 #define MAYBE_TestNativeDisplaysChanged TestNativeDisplaysChanged
319 #define MAYBE_NativeDisplaysChangedAfterPrimaryChange \
320 NativeDisplaysChangedAfterPrimaryChange
321 #else
322 #define MAYBE_TestDeviceScaleOnlyChange DISABLED_TestDeviceScaleOnlyChange
323 #define MAYBE_TestNativeDisplaysChanged DISABLED_TestNativeDisplaysChanged
324 #define MAYBE_NativeDisplaysChangedAfterPrimaryChange \
325 DISABLED_NativeDisplaysChangedAfterPrimaryChange
326 #endif
327
328 TEST_F(DisplayManagerTest, MAYBE_TestDeviceScaleOnlyChange) {
329 UpdateDisplay("1000x600"); 302 UpdateDisplay("1000x600");
330 EXPECT_EQ(1, 303 EXPECT_EQ(1,
331 Shell::GetPrimaryRootWindow()->compositor()->device_scale_factor()); 304 Shell::GetPrimaryRootWindow()->compositor()->device_scale_factor());
332 EXPECT_EQ("1000x600", 305 EXPECT_EQ("1000x600",
333 Shell::GetPrimaryRootWindow()->bounds().size().ToString()); 306 Shell::GetPrimaryRootWindow()->bounds().size().ToString());
334 UpdateDisplay("1000x600*2"); 307 UpdateDisplay("1000x600*2");
335 EXPECT_EQ(2, 308 EXPECT_EQ(2,
336 Shell::GetPrimaryRootWindow()->compositor()->device_scale_factor()); 309 Shell::GetPrimaryRootWindow()->compositor()->device_scale_factor());
337 EXPECT_EQ("500x300", 310 EXPECT_EQ("500x300",
338 Shell::GetPrimaryRootWindow()->bounds().size().ToString()); 311 Shell::GetPrimaryRootWindow()->bounds().size().ToString());
339 } 312 }
340 313
341 TEST_F(DisplayManagerTest, MAYBE_TestNativeDisplaysChanged) { 314 TEST_F(DisplayManagerTest, TestNativeDisplaysChanged) {
342 const int64 internal_display_id = 315 const int64 internal_display_id =
343 display_manager()->SetFirstDisplayAsInternalDisplayForTest(); 316 display_manager()->SetFirstDisplayAsInternalDisplayForTest();
344 const gfx::Display native_display(internal_display_id, 317 const gfx::Display native_display(internal_display_id,
345 gfx::Rect(0, 0, 500, 500)); 318 gfx::Rect(0, 0, 500, 500));
346 319
347 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); 320 EXPECT_EQ(1U, display_manager()->GetNumDisplays());
348 std::string default_bounds = 321 std::string default_bounds =
349 display_manager()->GetDisplayAt(0)->bounds().ToString(); 322 display_manager()->GetDisplayAt(0)->bounds().ToString();
350 323
351 std::vector<gfx::Display> displays; 324 std::vector<gfx::Display> displays;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 FindDisplayForId(10).bounds_in_pixel().ToString()); 368 FindDisplayForId(10).bounds_in_pixel().ToString());
396 369
397 // External display has disconnected then resumed. 370 // External display has disconnected then resumed.
398 displays.push_back(native_display); 371 displays.push_back(native_display);
399 display_manager()->OnNativeDisplaysChanged(displays); 372 display_manager()->OnNativeDisplaysChanged(displays);
400 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); 373 EXPECT_EQ(1U, display_manager()->GetNumDisplays());
401 EXPECT_EQ("0,0 500x500", 374 EXPECT_EQ("0,0 500x500",
402 FindDisplayForId(internal_display_id).bounds().ToString()); 375 FindDisplayForId(internal_display_id).bounds().ToString());
403 } 376 }
404 377
405 #if defined(OS_CHROMEOS) 378 TEST_F(DisplayManagerTest, EnsurePointerInDisplays) {
406 #define MAYBE_EnsurePointerInDisplays EnsurePointerInDisplays
407 #define MAYBE_EnsurePointerInDisplays_2ndOnLeft \
408 EnsurePointerInDisplays_2ndOnLeft
409 #else
410 // TODO(oshima): Re-enable these tests on WinAura (http://crbug.com/158163).
411 #define MAYBE_EnsurePointerInDisplays DISABLED_EnsurePointerInDisplays
412 #define MAYBE_EnsurePointerInDisplays_2ndOnLeft \
413 DISABLED_EnsurePointerInDisplays_2ndOnLeft
414 #endif
415
416 TEST_F(DisplayManagerTest, MAYBE_EnsurePointerInDisplays) {
417 UpdateDisplay("200x200,300x300"); 379 UpdateDisplay("200x200,300x300");
418 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 380 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
419 381
420 aura::Env* env = aura::Env::GetInstance(); 382 aura::Env* env = aura::Env::GetInstance();
421 383
422 // Set the initial position. 384 // Set the initial position.
423 root_windows[0]->MoveCursorTo(gfx::Point(350, 150)); 385 root_windows[0]->MoveCursorTo(gfx::Point(350, 150));
424 EXPECT_EQ("350,150", env->last_mouse_location().ToString()); 386 EXPECT_EQ("350,150", env->last_mouse_location().ToString());
425 387
426 // A mouse pointer will be inside 2nd display. 388 // A mouse pointer will be inside 2nd display.
(...skipping 17 matching lines...) Expand all
444 406
445 // Move the mouse pointer to the bottom of 1st display. 407 // Move the mouse pointer to the bottom of 1st display.
446 root_windows[0]->MoveCursorTo(gfx::Point(150, 290)); 408 root_windows[0]->MoveCursorTo(gfx::Point(150, 290));
447 EXPECT_EQ("150,290", env->last_mouse_location().ToString()); 409 EXPECT_EQ("150,290", env->last_mouse_location().ToString());
448 410
449 // The mouse pointer is outside and closest display is 1st one. 411 // The mouse pointer is outside and closest display is 1st one.
450 UpdateDisplay("300x280,200x200"); 412 UpdateDisplay("300x280,200x200");
451 EXPECT_EQ("150,140", env->last_mouse_location().ToString()); 413 EXPECT_EQ("150,140", env->last_mouse_location().ToString());
452 } 414 }
453 415
454 TEST_F(DisplayManagerTest, MAYBE_EnsurePointerInDisplays_2ndOnLeft) { 416 TEST_F(DisplayManagerTest, EnsurePointerInDisplays_2ndOnLeft) {
455 UpdateDisplay("200x200,300x300"); 417 UpdateDisplay("200x200,300x300");
456 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 418 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
457 419
458 // Set the 2nd display on the left. 420 // Set the 2nd display on the left.
459 DisplayController* display_controller = 421 DisplayController* display_controller =
460 Shell::GetInstance()->display_controller(); 422 Shell::GetInstance()->display_controller();
461 DisplayLayout layout = display_controller->default_display_layout(); 423 DisplayLayout layout = display_controller->default_display_layout();
462 layout.position = DisplayLayout::LEFT; 424 layout.position = DisplayLayout::LEFT;
463 display_controller->SetDefaultDisplayLayout(layout); 425 display_controller->SetDefaultDisplayLayout(layout);
464 426
(...skipping 14 matching lines...) Expand all
479 // center of 2nd display. 441 // center of 2nd display.
480 UpdateDisplay("300x300,200x100"); 442 UpdateDisplay("300x300,200x100");
481 EXPECT_EQ("-100,50", env->last_mouse_location().ToString()); 443 EXPECT_EQ("-100,50", env->last_mouse_location().ToString());
482 444
483 // 2nd display was disconnected. Mouse pointer should move to 445 // 2nd display was disconnected. Mouse pointer should move to
484 // 1st display. 446 // 1st display.
485 UpdateDisplay("300x300"); 447 UpdateDisplay("300x300");
486 EXPECT_EQ("150,150", env->last_mouse_location().ToString()); 448 EXPECT_EQ("150,150", env->last_mouse_location().ToString());
487 } 449 }
488 450
489 TEST_F(DisplayManagerTest, MAYBE_NativeDisplaysChangedAfterPrimaryChange) { 451 TEST_F(DisplayManagerTest, NativeDisplaysChangedAfterPrimaryChange) {
490 const int64 internal_display_id = 452 const int64 internal_display_id =
491 display_manager()->SetFirstDisplayAsInternalDisplayForTest(); 453 display_manager()->SetFirstDisplayAsInternalDisplayForTest();
492 const gfx::Display native_display(internal_display_id, 454 const gfx::Display native_display(internal_display_id,
493 gfx::Rect(0, 0, 500, 500)); 455 gfx::Rect(0, 0, 500, 500));
494 const gfx::Display secondary_display(10, gfx::Rect(1, 1, 100, 100)); 456 const gfx::Display secondary_display(10, gfx::Rect(1, 1, 100, 100));
495 457
496 std::vector<gfx::Display> displays; 458 std::vector<gfx::Display> displays;
497 displays.push_back(native_display); 459 displays.push_back(native_display);
498 displays.push_back(secondary_display); 460 displays.push_back(secondary_display);
499 display_manager()->OnNativeDisplaysChanged(displays); 461 display_manager()->OnNativeDisplaysChanged(displays);
(...skipping 11 matching lines...) Expand all
511 // OnNativeDisplaysChanged may change the display bounds. Here makes sure 473 // OnNativeDisplaysChanged may change the display bounds. Here makes sure
512 // nothing changed if the exactly same displays are specified. 474 // nothing changed if the exactly same displays are specified.
513 display_manager()->OnNativeDisplaysChanged(displays); 475 display_manager()->OnNativeDisplaysChanged(displays);
514 EXPECT_EQ("-500,0 500x500", 476 EXPECT_EQ("-500,0 500x500",
515 FindDisplayForId(internal_display_id).bounds().ToString()); 477 FindDisplayForId(internal_display_id).bounds().ToString());
516 EXPECT_EQ("0,0 100x100", FindDisplayForId(10).bounds().ToString()); 478 EXPECT_EQ("0,0 100x100", FindDisplayForId(10).bounds().ToString());
517 } 479 }
518 480
519 } // namespace internal 481 } // namespace internal
520 } // namespace ash 482 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/display_controller_unittest.cc ('k') | ash/extended_desktop_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698