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

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

Issue 2335963002: Refactor: remove SetDisplayWorkAreaInsets calls. (Closed)
Patch Set: Created 4 years, 3 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
« no previous file with comments | « ash/display/display_manager_unittest.cc ('k') | ash/shell.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/window_tree_host_manager.h" 5 #include "ash/display/window_tree_host_manager.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "ash/common/ash_switches.h" 9 #include "ash/common/ash_switches.h"
10 #include "ash/common/display/display_info.h" 10 #include "ash/common/display/display_info.h"
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 return; 410 return;
411 411
412 // Creates windows to catch activation change event. 412 // Creates windows to catch activation change event.
413 std::unique_ptr<aura::Window> w1(CreateTestWindowInShellWithId(1)); 413 std::unique_ptr<aura::Window> w1(CreateTestWindowInShellWithId(1));
414 w1->Focus(); 414 w1->Focus();
415 415
416 TestObserver observer; 416 TestObserver observer;
417 UpdateDisplay("500x500,400x400"); 417 UpdateDisplay("500x500,400x400");
418 EXPECT_EQ(1, observer.CountAndReset()); // resize and add 418 EXPECT_EQ(1, observer.CountAndReset()); // resize and add
419 EXPECT_EQ(1, observer.GetBoundsChangedCountAndReset()); 419 EXPECT_EQ(1, observer.GetBoundsChangedCountAndReset());
420 EXPECT_EQ(1, observer.GetWorkareaChangedCountAndReset()); 420 EXPECT_EQ(2, observer.GetWorkareaChangedCountAndReset());
421 EXPECT_EQ(0, observer.GetFocusChangedCountAndReset()); 421 EXPECT_EQ(0, observer.GetFocusChangedCountAndReset());
422 EXPECT_EQ(0, observer.GetActivationChangedCountAndReset()); 422 EXPECT_EQ(0, observer.GetActivationChangedCountAndReset());
423 gfx::Insets insets(5, 5, 5, 5); 423 gfx::Insets insets(5, 5, 5, 5);
424 int64_t secondary_display_id = ScreenUtil::GetSecondaryDisplay().id(); 424 int64_t secondary_display_id = ScreenUtil::GetSecondaryDisplay().id();
425 Shell::GetInstance()->display_manager()->UpdateWorkAreaOfDisplay( 425 Shell::GetInstance()->display_manager()->UpdateWorkAreaOfDisplay(
426 secondary_display_id, insets); 426 secondary_display_id, insets);
427 427
428 // Default layout is RIGHT. 428 // Default layout is RIGHT.
429 EXPECT_EQ("0,0 500x500", GetPrimaryDisplay().bounds().ToString()); 429 EXPECT_EQ("0,0 500x500", GetPrimaryDisplay().bounds().ToString());
430 EXPECT_EQ("500,0 400x400", GetSecondaryDisplay().bounds().ToString()); 430 EXPECT_EQ("500,0 400x400", GetSecondaryDisplay().bounds().ToString());
431 EXPECT_EQ("505,5 390x390", GetSecondaryDisplay().work_area().ToString()); 431 EXPECT_EQ("505,5 390x390", GetSecondaryDisplay().work_area().ToString());
432 EXPECT_EQ(0, observer.GetFocusChangedCountAndReset()); 432 EXPECT_EQ(0, observer.GetFocusChangedCountAndReset());
433 EXPECT_EQ(0, observer.GetActivationChangedCountAndReset()); 433 EXPECT_EQ(0, observer.GetActivationChangedCountAndReset());
434 434
435 // Layout the secondary display to the bottom of the primary. 435 // Layout the secondary display to the bottom of the primary.
436 SetSecondaryDisplayLayout(display::DisplayPlacement::BOTTOM); 436 SetSecondaryDisplayLayout(display::DisplayPlacement::BOTTOM);
437 EXPECT_EQ(1, observer.CountAndReset()); 437 EXPECT_EQ(1, observer.CountAndReset());
438 EXPECT_EQ(1, observer.GetBoundsChangedCountAndReset()); 438 EXPECT_EQ(1, observer.GetBoundsChangedCountAndReset());
439 EXPECT_EQ(1, observer.GetWorkareaChangedCountAndReset()); 439 // TODO (oshima): work area changes twice because ShelfLayoutManager updates
440 // to its own insets.
441 EXPECT_EQ(2, observer.GetWorkareaChangedCountAndReset());
440 EXPECT_EQ(0, observer.GetFocusChangedCountAndReset()); 442 EXPECT_EQ(0, observer.GetFocusChangedCountAndReset());
441 EXPECT_EQ(0, observer.GetActivationChangedCountAndReset()); 443 EXPECT_EQ(0, observer.GetActivationChangedCountAndReset());
442 EXPECT_EQ(secondary_display_id, observer.GetChangedDisplayIdAndReset()); 444 EXPECT_EQ(secondary_display_id, observer.GetChangedDisplayIdAndReset());
443 EXPECT_EQ("0,0 500x500", GetPrimaryDisplay().bounds().ToString()); 445 EXPECT_EQ("0,0 500x500", GetPrimaryDisplay().bounds().ToString());
444 EXPECT_EQ("0,500 400x400", GetSecondaryDisplay().bounds().ToString()); 446 EXPECT_EQ("0,500 400x400", GetSecondaryDisplay().bounds().ToString());
445 EXPECT_EQ("5,505 390x390", GetSecondaryDisplay().work_area().ToString()); 447 EXPECT_EQ("5,505 390x390", GetSecondaryDisplay().work_area().ToString());
446 448
447 // Layout the secondary display to the left of the primary. 449 // Layout the secondary display to the left of the primary.
448 SetSecondaryDisplayLayout(display::DisplayPlacement::LEFT); 450 SetSecondaryDisplayLayout(display::DisplayPlacement::LEFT);
449 EXPECT_EQ(1, observer.CountAndReset()); 451 EXPECT_EQ(1, observer.CountAndReset());
(...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after
1522 widget->GetNativeWindow()->GetRootWindow()); 1524 widget->GetNativeWindow()->GetRootWindow());
1523 event_generator.MoveMouseToCenterOf(widget->GetNativeWindow()); 1525 event_generator.MoveMouseToCenterOf(widget->GetNativeWindow());
1524 1526
1525 UpdateDisplay("300x300"); 1527 UpdateDisplay("300x300");
1526 watcher.Stop(); 1528 watcher.Stop();
1527 1529
1528 widget->CloseNow(); 1530 widget->CloseNow();
1529 } 1531 }
1530 1532
1531 } // namespace ash 1533 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/display_manager_unittest.cc ('k') | ash/shell.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698