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

Side by Side Diff: ui/gfx/color_profile_mac_unittest.mm

Issue 1380083005: Mac: Use [NSArray firstObject] for [NSScreen screens] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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/events/cocoa/events_mac_unittest.mm ('k') | ui/gfx/mac/coordinate_conversion.mm » ('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 <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #include "base/mac/scoped_nsobject.h" 7 #include "base/mac/scoped_nsobject.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "ui/gfx/color_profile.h" 9 #include "ui/gfx/color_profile.h"
10 #include "ui/gfx/mac/coordinate_conversion.h" 10 #include "ui/gfx/mac/coordinate_conversion.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 BOOL TestWindowOnScreen() { 45 BOOL TestWindowOnScreen() {
46 return NSIntersectsRect(PrimaryScreenFrame(), [test_window() frame]); 46 return NSIntersectsRect(PrimaryScreenFrame(), [test_window() frame]);
47 } 47 }
48 48
49 BOOL TestWindowContainedOnScreen() { 49 BOOL TestWindowContainedOnScreen() {
50 return NSContainsRect(PrimaryScreenFrame(), [test_window() frame]); 50 return NSContainsRect(PrimaryScreenFrame(), [test_window() frame]);
51 } 51 }
52 52
53 NSRect PrimaryScreenFrame() { 53 NSRect PrimaryScreenFrame() {
54 return [[[NSScreen screens] objectAtIndex:0] frame]; 54 return [[[NSScreen screens] firstObject] frame];
55 } 55 }
56 }; 56 };
57 57
58 bool TestColorProfileForBounds(const gfx::Rect& bounds) { 58 bool TestColorProfileForBounds(const gfx::Rect& bounds) {
59 std::vector<char> color_profile; 59 std::vector<char> color_profile;
60 return gfx::GetDisplayColorProfile(bounds, &color_profile); 60 return gfx::GetDisplayColorProfile(bounds, &color_profile);
61 } 61 }
62 62
63 TEST_F(ColorProfileTest, GetDisplayColorProfileForOnScreenBounds) { 63 TEST_F(ColorProfileTest, GetDisplayColorProfileForOnScreenBounds) {
64 MoveTestWindowTo(gfx::Rect(10, 10, 100, 100)); 64 MoveTestWindowTo(gfx::Rect(10, 10, 100, 100));
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 EXPECT_FALSE(TestWindowOnScreen()); 134 EXPECT_FALSE(TestWindowOnScreen());
135 EXPECT_FALSE(TestColorProfileForWindow(test_window())); 135 EXPECT_FALSE(TestColorProfileForWindow(test_window()));
136 } 136 }
137 137
138 TEST_F(ColorProfileTest, GetDisplayColorProfileForNullWindow) { 138 TEST_F(ColorProfileTest, GetDisplayColorProfileForNullWindow) {
139 EXPECT_FALSE(TestColorProfileForWindow(nullptr)); 139 EXPECT_FALSE(TestColorProfileForWindow(nullptr));
140 EXPECT_FALSE(TestColorProfileForWindow(nil)); 140 EXPECT_FALSE(TestColorProfileForWindow(nil));
141 } 141 }
142 142
143 } // namespace 143 } // namespace
OLDNEW
« no previous file with comments | « ui/events/cocoa/events_mac_unittest.mm ('k') | ui/gfx/mac/coordinate_conversion.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698