Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/public/browser/window_util.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 "testing/platform_test.h" | 11 #include "testing/platform_test.h" |
| 12 #include "ui/gfx/rect.h" | 12 #include "ui/gfx/rect.h" |
| 13 | 13 |
| 14 #if !defined(MAC_OS_X_VERSION_10_7) || \ | 14 #if !defined(MAC_OS_X_VERSION_10_7) || \ |
| 15 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 | 15 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 |
| 16 | 16 |
| 17 @interface NSWindow (LionAPI) | 17 @interface NSWindow (LionAPI) |
| 18 - (CGFloat)backingScaleFactor; | 18 - (CGFloat)backingScaleFactor; |
| 19 @end | 19 @end |
| 20 | 20 |
| 21 #endif // 10.7 | 21 #endif // 10.7 |
| 22 | 22 |
| 23 namespace chrome { | 23 namespace chrome { |
|
jam
2012/11/09 02:21:29
update the namespace
| |
| 24 namespace { | 24 namespace { |
| 25 | 25 |
| 26 typedef PlatformTest GrabWindowSnapshotTest; | 26 typedef PlatformTest GrabWindowSnapshotTest; |
| 27 | 27 |
| 28 TEST_F(GrabWindowSnapshotTest, TestGrabWindowSnapshot) { | 28 TEST_F(GrabWindowSnapshotTest, TestGrabWindowSnapshot) { |
| 29 // Launch a test window so we can take a snapshot. | 29 // Launch a test window so we can take a snapshot. |
| 30 NSRect frame = NSMakeRect(0, 0, 400, 400); | 30 NSRect frame = NSMakeRect(0, 0, 400, 400); |
| 31 scoped_nsobject<NSWindow> window( | 31 scoped_nsobject<NSWindow> window( |
| 32 [[NSWindow alloc] initWithContentRect:frame | 32 [[NSWindow alloc] initWithContentRect:frame |
| 33 styleMask:NSBorderlessWindowMask | 33 styleMask:NSBorderlessWindowMask |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 53 scaleFactor = [window backingScaleFactor]; | 53 scaleFactor = [window backingScaleFactor]; |
| 54 EXPECT_EQ(400 * scaleFactor, CGImageGetWidth([rep CGImage])); | 54 EXPECT_EQ(400 * scaleFactor, CGImageGetWidth([rep CGImage])); |
| 55 NSColor* color = [rep colorAtX:200 * scaleFactor y:200 * scaleFactor]; | 55 NSColor* color = [rep colorAtX:200 * scaleFactor y:200 * scaleFactor]; |
| 56 CGFloat red = 0, green = 0, blue = 0, alpha = 0; | 56 CGFloat red = 0, green = 0, blue = 0, alpha = 0; |
| 57 [color getRed:&red green:&green blue:&blue alpha:&alpha]; | 57 [color getRed:&red green:&green blue:&blue alpha:&alpha]; |
| 58 EXPECT_GE(red + green + blue, 3.0); | 58 EXPECT_GE(red + green + blue, 3.0); |
| 59 } | 59 } |
| 60 | 60 |
| 61 } // namespace | 61 } // namespace |
| 62 } // namespace chrome | 62 } // namespace chrome |
| OLD | NEW |