| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/ui/window_snapshot/window_snapshot.h" | 5 #include "chrome/browser/ui/window_snapshot/window_snapshot.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #include "base/scoped_nsobject.h" | 9 #include "base/scoped_nsobject.h" |
| 10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
| 11 #include "base/test/mock_chrome_application_mac.h" | 11 #include "base/test/mock_chrome_application_mac.h" |
| 12 #include "gfx/rect.h" | |
| 13 #include "testing/platform_test.h" | 12 #include "testing/platform_test.h" |
| 13 #include "ui/gfx/rect.h" |
| 14 | 14 |
| 15 namespace browser { | 15 namespace browser { |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 typedef PlatformTest GrabWindowSnapshotTest; | 18 typedef PlatformTest GrabWindowSnapshotTest; |
| 19 | 19 |
| 20 TEST_F(GrabWindowSnapshotTest, TestGrabWindowSnapshot) { | 20 TEST_F(GrabWindowSnapshotTest, TestGrabWindowSnapshot) { |
| 21 // Launch a test window so we can take a snapshot. | 21 // Launch a test window so we can take a snapshot. |
| 22 NSRect frame = NSMakeRect(0, 0, 400, 400); | 22 NSRect frame = NSMakeRect(0, 0, 400, 400); |
| 23 scoped_nsobject<NSWindow> window( | 23 scoped_nsobject<NSWindow> window( |
| (...skipping 16 matching lines...) Expand all Loading... |
| 40 EXPECT_TRUE([rep isKindOfClass:[NSBitmapImageRep class]]); | 40 EXPECT_TRUE([rep isKindOfClass:[NSBitmapImageRep class]]); |
| 41 EXPECT_TRUE(CGImageGetWidth([rep CGImage]) == 400); | 41 EXPECT_TRUE(CGImageGetWidth([rep CGImage]) == 400); |
| 42 NSColor* color = [rep colorAtX:200 y:200]; | 42 NSColor* color = [rep colorAtX:200 y:200]; |
| 43 CGFloat red = 0, green = 0, blue = 0, alpha = 0; | 43 CGFloat red = 0, green = 0, blue = 0, alpha = 0; |
| 44 [color getRed:&red green:&green blue:&blue alpha:&alpha]; | 44 [color getRed:&red green:&green blue:&blue alpha:&alpha]; |
| 45 EXPECT_GE(red + green + blue, 3.0); | 45 EXPECT_GE(red + green + blue, 3.0); |
| 46 } | 46 } |
| 47 | 47 |
| 48 } // namespace | 48 } // namespace |
| 49 } // namespace browser | 49 } // namespace browser |
| OLD | NEW |