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

Side by Side Diff: ui/gfx/mac/coordinate_conversion_unittest.mm

Issue 1868363002: Replace scoped_ptr with std::unique_ptr in //ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scopedptrcc
Patch Set: scopedptrui: rebase-make_scoped_ptr 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 | « ui/gfx/linux_font_delegate.h ('k') | ui/gfx/path_win.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #import "ui/gfx/mac/coordinate_conversion.h" 5 #import "ui/gfx/mac/coordinate_conversion.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include <memory>
10
9 #import "base/mac/scoped_objc_class_swizzler.h" 11 #import "base/mac/scoped_objc_class_swizzler.h"
10 #include "base/macros.h" 12 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h"
12 #import "testing/gtest_mac.h" 13 #import "testing/gtest_mac.h"
13 #import "testing/platform_test.h" 14 #import "testing/platform_test.h"
14 #include "ui/gfx/geometry/rect.h" 15 #include "ui/gfx/geometry/rect.h"
15 16
16 const int kTestWidth = 320; 17 const int kTestWidth = 320;
17 const int kTestHeight = 200; 18 const int kTestHeight = 200;
18 19
19 // Class to donate an implementation of -[NSScreen frame] that provides a known 20 // Class to donate an implementation of -[NSScreen frame] that provides a known
20 // value for robust tests. 21 // value for robust tests.
21 @interface MacCoordinateConversionTestScreenDonor : NSObject 22 @interface MacCoordinateConversionTestScreenDonor : NSObject
(...skipping 11 matching lines...) Expand all
33 34
34 class MacCoordinateConversionTest : public PlatformTest { 35 class MacCoordinateConversionTest : public PlatformTest {
35 public: 36 public:
36 MacCoordinateConversionTest() {} 37 MacCoordinateConversionTest() {}
37 38
38 // Overridden from testing::Test: 39 // Overridden from testing::Test:
39 void SetUp() override; 40 void SetUp() override;
40 void TearDown() override; 41 void TearDown() override;
41 42
42 private: 43 private:
43 scoped_ptr<base::mac::ScopedObjCClassSwizzler> swizzle_frame_; 44 std::unique_ptr<base::mac::ScopedObjCClassSwizzler> swizzle_frame_;
44 45
45 DISALLOW_COPY_AND_ASSIGN(MacCoordinateConversionTest); 46 DISALLOW_COPY_AND_ASSIGN(MacCoordinateConversionTest);
46 }; 47 };
47 48
48 void MacCoordinateConversionTest::SetUp() { 49 void MacCoordinateConversionTest::SetUp() {
49 // Before swizzling, do a sanity check that the primary screen's origin is 50 // Before swizzling, do a sanity check that the primary screen's origin is
50 // (0, 0). This should always be true. 51 // (0, 0). This should always be true.
51 NSRect primary_screen_frame = [[[NSScreen screens] firstObject] frame]; 52 NSRect primary_screen_frame = [[[NSScreen screens] firstObject] frame];
52 EXPECT_EQ(0, primary_screen_frame.origin.x); 53 EXPECT_EQ(0, primary_screen_frame.origin.x);
53 EXPECT_EQ(0, primary_screen_frame.origin.y); 54 EXPECT_EQ(0, primary_screen_frame.origin.y);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 EXPECT_EQ(gfx_point, ScreenPointFromNSPoint(ns_point)); 129 EXPECT_EQ(gfx_point, ScreenPointFromNSPoint(ns_point));
129 130
130 // Point in a screen below and to the left primary screen. 131 // Point in a screen below and to the left primary screen.
131 gfx_point = Point(-40, 220); 132 gfx_point = Point(-40, 220);
132 ns_point = ScreenPointToNSPoint(gfx_point); 133 ns_point = ScreenPointToNSPoint(gfx_point);
133 EXPECT_NSEQ(NSMakePoint(-40, -20), ns_point); 134 EXPECT_NSEQ(NSMakePoint(-40, -20), ns_point);
134 EXPECT_EQ(gfx_point, ScreenPointFromNSPoint(ns_point)); 135 EXPECT_EQ(gfx_point, ScreenPointFromNSPoint(ns_point));
135 } 136 }
136 137
137 } // namespace gfx 138 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/linux_font_delegate.h ('k') | ui/gfx/path_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698