| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |