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/memory/scoped_nsobject.h" | 9 #include "base/memory/scoped_nsobject.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/test/mock_chrome_application_mac.h" | |
12 #include "testing/platform_test.h" | 11 #include "testing/platform_test.h" |
13 #include "ui/gfx/rect.h" | 12 #include "ui/gfx/rect.h" |
14 | 13 |
15 namespace browser { | 14 namespace browser { |
16 namespace { | 15 namespace { |
17 | 16 |
18 typedef PlatformTest GrabWindowSnapshotTest; | 17 typedef PlatformTest GrabWindowSnapshotTest; |
19 | 18 |
20 TEST_F(GrabWindowSnapshotTest, TestGrabWindowSnapshot) { | 19 TEST_F(GrabWindowSnapshotTest, TestGrabWindowSnapshot) { |
21 // Launch a test window so we can take a snapshot. | 20 // Launch a test window so we can take a snapshot. |
(...skipping 20 matching lines...) Expand all Loading... |
42 EXPECT_TRUE([rep isKindOfClass:[NSBitmapImageRep class]]); | 41 EXPECT_TRUE([rep isKindOfClass:[NSBitmapImageRep class]]); |
43 EXPECT_TRUE(CGImageGetWidth([rep CGImage]) == 400); | 42 EXPECT_TRUE(CGImageGetWidth([rep CGImage]) == 400); |
44 NSColor* color = [rep colorAtX:200 y:200]; | 43 NSColor* color = [rep colorAtX:200 y:200]; |
45 CGFloat red = 0, green = 0, blue = 0, alpha = 0; | 44 CGFloat red = 0, green = 0, blue = 0, alpha = 0; |
46 [color getRed:&red green:&green blue:&blue alpha:&alpha]; | 45 [color getRed:&red green:&green blue:&blue alpha:&alpha]; |
47 EXPECT_GE(red + green + blue, 3.0); | 46 EXPECT_GE(red + green + blue, 3.0); |
48 } | 47 } |
49 | 48 |
50 } // namespace | 49 } // namespace |
51 } // namespace browser | 50 } // namespace browser |
OLD | NEW |