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

Side by Side Diff: ash/display/root_window_transformers_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: address comments 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
« no previous file with comments | « ash/display/root_window_transformers.cc ('k') | ash/display/screen_ash_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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/root_window_transformers.h" 5 #include "ash/display/root_window_transformers.h"
6 6
7 #include <memory>
8
7 #include "ash/display/display_info.h" 9 #include "ash/display/display_info.h"
8 #include "ash/display/display_manager.h" 10 #include "ash/display/display_manager.h"
9 #include "ash/display/display_util.h" 11 #include "ash/display/display_util.h"
10 #include "ash/host/root_window_transformer.h" 12 #include "ash/host/root_window_transformer.h"
11 #include "ash/magnifier/magnification_controller.h" 13 #include "ash/magnifier/magnification_controller.h"
12 #include "ash/screen_util.h" 14 #include "ash/screen_util.h"
13 #include "ash/shelf/shelf.h" 15 #include "ash/shelf/shelf.h"
14 #include "ash/shelf/shelf_widget.h" 16 #include "ash/shelf/shelf_widget.h"
15 #include "ash/shell.h" 17 #include "ash/shell.h"
16 #include "ash/test/ash_test_base.h" 18 #include "ash/test/ash_test_base.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 float scroll_y_offset_ordinal_; 110 float scroll_y_offset_ordinal_;
109 111
110 DISALLOW_COPY_AND_ASSIGN(TestEventHandler); 112 DISALLOW_COPY_AND_ASSIGN(TestEventHandler);
111 }; 113 };
112 114
113 float GetStoredUIScale(int64_t id) { 115 float GetStoredUIScale(int64_t id) {
114 return Shell::GetInstance()->display_manager()->GetDisplayInfo(id). 116 return Shell::GetInstance()->display_manager()->GetDisplayInfo(id).
115 GetEffectiveUIScale(); 117 GetEffectiveUIScale();
116 } 118 }
117 119
118 scoped_ptr<RootWindowTransformer> 120 std::unique_ptr<RootWindowTransformer>
119 CreateCurrentRootWindowTransformerForMirroring() { 121 CreateCurrentRootWindowTransformerForMirroring() {
120 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); 122 DisplayManager* display_manager = Shell::GetInstance()->display_manager();
121 DCHECK(display_manager->IsInMirrorMode()); 123 DCHECK(display_manager->IsInMirrorMode());
122 const DisplayInfo& mirror_display_info = 124 const DisplayInfo& mirror_display_info =
123 display_manager->GetDisplayInfo(display_manager->mirroring_display_id()); 125 display_manager->GetDisplayInfo(display_manager->mirroring_display_id());
124 const DisplayInfo& source_display_info = display_manager->GetDisplayInfo( 126 const DisplayInfo& source_display_info = display_manager->GetDisplayInfo(
125 gfx::Screen::GetScreen()->GetPrimaryDisplay().id()); 127 gfx::Screen::GetScreen()->GetPrimaryDisplay().id());
126 return scoped_ptr<RootWindowTransformer>( 128 return std::unique_ptr<RootWindowTransformer>(
127 CreateRootWindowTransformerForMirroredDisplay(source_display_info, 129 CreateRootWindowTransformerForMirroredDisplay(source_display_info,
128 mirror_display_info)); 130 mirror_display_info));
129 } 131 }
130 132
131 } // namespace 133 } // namespace
132 134
133 typedef test::AshTestBase RootWindowTransformersTest; 135 typedef test::AshTestBase RootWindowTransformersTest;
134 136
135 #if defined(OS_WIN) 137 #if defined(OS_WIN)
136 // TODO(scottmg): RootWindow doesn't get resized on Windows 138 // TODO(scottmg): RootWindow doesn't get resized on Windows
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 Shell::GetInstance()->RemovePreTargetHandler(&event_handler); 404 Shell::GetInstance()->RemovePreTargetHandler(&event_handler);
403 } 405 }
404 406
405 TEST_F(RootWindowTransformersTest, LetterBoxPillarBox) { 407 TEST_F(RootWindowTransformersTest, LetterBoxPillarBox) {
406 if (!SupportsMultipleDisplays()) 408 if (!SupportsMultipleDisplays())
407 return; 409 return;
408 test::MirrorWindowTestApi test_api; 410 test::MirrorWindowTestApi test_api;
409 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); 411 DisplayManager* display_manager = Shell::GetInstance()->display_manager();
410 display_manager->SetMultiDisplayMode(DisplayManager::MIRRORING); 412 display_manager->SetMultiDisplayMode(DisplayManager::MIRRORING);
411 UpdateDisplay("400x200,500x500"); 413 UpdateDisplay("400x200,500x500");
412 scoped_ptr<RootWindowTransformer> transformer( 414 std::unique_ptr<RootWindowTransformer> transformer(
413 CreateCurrentRootWindowTransformerForMirroring()); 415 CreateCurrentRootWindowTransformerForMirroring());
414 // Y margin must be margin is (500 - 500/400 * 200) / 2 = 125. 416 // Y margin must be margin is (500 - 500/400 * 200) / 2 = 125.
415 EXPECT_EQ("0,125,0,125", transformer->GetHostInsets().ToString()); 417 EXPECT_EQ("0,125,0,125", transformer->GetHostInsets().ToString());
416 418
417 UpdateDisplay("200x400,500x500"); 419 UpdateDisplay("200x400,500x500");
418 // The aspect ratio is flipped, so X margin is now 125. 420 // The aspect ratio is flipped, so X margin is now 125.
419 transformer = CreateCurrentRootWindowTransformerForMirroring(); 421 transformer = CreateCurrentRootWindowTransformerForMirroring();
420 EXPECT_EQ("125,0,125,0", transformer->GetHostInsets().ToString()); 422 EXPECT_EQ("125,0,125,0", transformer->GetHostInsets().ToString());
421 } 423 }
422 424
423 } // namespace ash 425 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/root_window_transformers.cc ('k') | ash/display/screen_ash_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698