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

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

Issue 1867223004: Convert //ash from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
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
oshima 2016/04/08 07:09:40 include?
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/display/display_info.h" 8 #include "ash/display/display_info.h"
9 #include "ash/display/display_layout_store.h" 9 #include "ash/display/display_layout_store.h"
10 #include "ash/display/display_manager.h" 10 #include "ash/display/display_manager.h"
11 #include "ash/display/display_util.h" 11 #include "ash/display/display_util.h"
12 #include "ash/screen_util.h" 12 #include "ash/screen_util.h"
13 #include "ash/shelf/shelf.h" 13 #include "ash/shelf/shelf.h"
14 #include "ash/shelf/shelf_widget.h" 14 #include "ash/shelf/shelf_widget.h"
15 #include "ash/shell.h" 15 #include "ash/shell.h"
16 #include "ash/test/ash_test_base.h" 16 #include "ash/test/ash_test_base.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 } 180 }
181 181
182 gfx::Display GetSecondaryDisplay() { 182 gfx::Display GetSecondaryDisplay() {
183 return gfx::Screen::GetScreen()->GetDisplayNearestWindow( 183 return gfx::Screen::GetScreen()->GetDisplayNearestWindow(
184 Shell::GetAllRootWindows()[1]); 184 Shell::GetAllRootWindows()[1]);
185 } 185 }
186 186
187 void SetSecondaryDisplayLayoutAndOffset( 187 void SetSecondaryDisplayLayoutAndOffset(
188 display::DisplayPlacement::Position position, 188 display::DisplayPlacement::Position position,
189 int offset) { 189 int offset) {
190 scoped_ptr<display::DisplayLayout> layout( 190 std::unique_ptr<display::DisplayLayout> layout(
191 test::CreateDisplayLayout(position, offset)); 191 test::CreateDisplayLayout(position, offset));
192 ASSERT_GT(gfx::Screen::GetScreen()->GetNumDisplays(), 1); 192 ASSERT_GT(gfx::Screen::GetScreen()->GetNumDisplays(), 1);
193 Shell::GetInstance()->display_manager()->SetLayoutForCurrentDisplays( 193 Shell::GetInstance()->display_manager()->SetLayoutForCurrentDisplays(
194 std::move(layout)); 194 std::move(layout));
195 } 195 }
196 196
197 void SetSecondaryDisplayLayout(display::DisplayPlacement::Position position) { 197 void SetSecondaryDisplayLayout(display::DisplayPlacement::Position position) {
198 SetSecondaryDisplayLayoutAndOffset(position, 0); 198 SetSecondaryDisplayLayoutAndOffset(position, 0);
199 } 199 }
200 200
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 return; 389 return;
390 390
391 EXPECT_TRUE(startup_helper()->displays_initialized()); 391 EXPECT_TRUE(startup_helper()->displays_initialized());
392 } 392 }
393 393
394 TEST_F(WindowTreeHostManagerTest, SecondaryDisplayLayout) { 394 TEST_F(WindowTreeHostManagerTest, SecondaryDisplayLayout) {
395 if (!SupportsMultipleDisplays()) 395 if (!SupportsMultipleDisplays())
396 return; 396 return;
397 397
398 // Creates windows to catch activation change event. 398 // Creates windows to catch activation change event.
399 scoped_ptr<aura::Window> w1(CreateTestWindowInShellWithId(1)); 399 std::unique_ptr<aura::Window> w1(CreateTestWindowInShellWithId(1));
400 w1->Focus(); 400 w1->Focus();
401 401
402 TestObserver observer; 402 TestObserver observer;
403 UpdateDisplay("500x500,400x400"); 403 UpdateDisplay("500x500,400x400");
404 EXPECT_EQ(1, observer.CountAndReset()); // resize and add 404 EXPECT_EQ(1, observer.CountAndReset()); // resize and add
405 EXPECT_EQ(1, observer.GetBoundsChangedCountAndReset()); 405 EXPECT_EQ(1, observer.GetBoundsChangedCountAndReset());
406 EXPECT_EQ(1, observer.GetWorkareaChangedCountAndReset()); 406 EXPECT_EQ(1, observer.GetWorkareaChangedCountAndReset());
407 EXPECT_EQ(0, observer.GetFocusChangedCountAndReset()); 407 EXPECT_EQ(0, observer.GetFocusChangedCountAndReset());
408 EXPECT_EQ(0, observer.GetActivationChangedCountAndReset()); 408 EXPECT_EQ(0, observer.GetActivationChangedCountAndReset());
409 gfx::Insets insets(5, 5, 5, 5); 409 gfx::Insets insets(5, 5, 5, 5);
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 return info; 551 return info;
552 } 552 }
553 553
554 } // namespace 554 } // namespace
555 555
556 TEST_F(WindowTreeHostManagerTest, MirrorToDockedWithFullscreen) { 556 TEST_F(WindowTreeHostManagerTest, MirrorToDockedWithFullscreen) {
557 if (!SupportsMultipleDisplays()) 557 if (!SupportsMultipleDisplays())
558 return; 558 return;
559 559
560 // Creates windows to catch activation change event. 560 // Creates windows to catch activation change event.
561 scoped_ptr<aura::Window> w1(CreateTestWindowInShellWithId(1)); 561 std::unique_ptr<aura::Window> w1(CreateTestWindowInShellWithId(1));
562 w1->Focus(); 562 w1->Focus();
563 563
564 // Docked mode. 564 // Docked mode.
565 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); 565 DisplayManager* display_manager = Shell::GetInstance()->display_manager();
566 566
567 const DisplayInfo internal_display_info = CreateMirroredDisplayInfo(1, 2.0f); 567 const DisplayInfo internal_display_info = CreateMirroredDisplayInfo(1, 2.0f);
568 const DisplayInfo external_display_info = CreateMirroredDisplayInfo(2, 1.0f); 568 const DisplayInfo external_display_info = CreateMirroredDisplayInfo(2, 1.0f);
569 569
570 std::vector<DisplayInfo> display_info_list; 570 std::vector<DisplayInfo> display_info_list;
571 // Mirror. 571 // Mirror.
(...skipping 29 matching lines...) Expand all
601 601
602 EXPECT_TRUE(window_state->IsFullscreen()); 602 EXPECT_TRUE(window_state->IsFullscreen());
603 EXPECT_EQ("0,0 500x500", w1->bounds().ToString()); 603 EXPECT_EQ("0,0 500x500", w1->bounds().ToString());
604 } 604 }
605 605
606 TEST_F(WindowTreeHostManagerTest, BoundsUpdated) { 606 TEST_F(WindowTreeHostManagerTest, BoundsUpdated) {
607 if (!SupportsMultipleDisplays()) 607 if (!SupportsMultipleDisplays())
608 return; 608 return;
609 609
610 // Creates windows to catch activation change event. 610 // Creates windows to catch activation change event.
611 scoped_ptr<aura::Window> w1(CreateTestWindowInShellWithId(1)); 611 std::unique_ptr<aura::Window> w1(CreateTestWindowInShellWithId(1));
612 w1->Focus(); 612 w1->Focus();
613 613
614 TestObserver observer; 614 TestObserver observer;
615 SetDefaultDisplayLayout(display::DisplayPlacement::BOTTOM); 615 SetDefaultDisplayLayout(display::DisplayPlacement::BOTTOM);
616 UpdateDisplay("200x200,300x300"); // layout, resize and add. 616 UpdateDisplay("200x200,300x300"); // layout, resize and add.
617 EXPECT_EQ(1, observer.CountAndReset()); 617 EXPECT_EQ(1, observer.CountAndReset());
618 EXPECT_EQ(0, observer.GetFocusChangedCountAndReset()); 618 EXPECT_EQ(0, observer.GetFocusChangedCountAndReset());
619 EXPECT_EQ(0, observer.GetActivationChangedCountAndReset()); 619 EXPECT_EQ(0, observer.GetActivationChangedCountAndReset());
620 620
621 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); 621 DisplayManager* display_manager = Shell::GetInstance()->display_manager();
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after
1490 widget->GetNativeWindow()->GetRootWindow()); 1490 widget->GetNativeWindow()->GetRootWindow());
1491 event_generator.MoveMouseToCenterOf(widget->GetNativeWindow()); 1491 event_generator.MoveMouseToCenterOf(widget->GetNativeWindow());
1492 1492
1493 UpdateDisplay("300x300"); 1493 UpdateDisplay("300x300");
1494 watcher.Stop(); 1494 watcher.Stop();
1495 1495
1496 widget->CloseNow(); 1496 widget->CloseNow();
1497 } 1497 }
1498 1498
1499 } // namespace ash 1499 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698