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

Side by Side Diff: ui/snapshot/snapshot_mac_unittest.mm

Issue 15870009: mac: Move more 10.7 api stuff into sdk_forward_declarations.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « ui/gfx/screen_mac.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ui/snapshot/snapshot.h" 5 #include "ui/snapshot/snapshot.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "base/mac/sdk_forward_declarations.h"
9 #include "base/memory/scoped_nsobject.h" 10 #include "base/memory/scoped_nsobject.h"
10 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
11 #include "testing/platform_test.h" 12 #include "testing/platform_test.h"
12 #include "ui/gfx/rect.h" 13 #include "ui/gfx/rect.h"
13 14
14 #if !defined(MAC_OS_X_VERSION_10_7) || \
15 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
16
17 @interface NSWindow (LionAPI)
18 - (CGFloat)backingScaleFactor;
19 @end
20
21 #endif // 10.7
22
23 namespace ui { 15 namespace ui {
24 namespace { 16 namespace {
25 17
26 typedef PlatformTest GrabWindowSnapshotTest; 18 typedef PlatformTest GrabWindowSnapshotTest;
27 19
28 TEST_F(GrabWindowSnapshotTest, TestGrabWindowSnapshot) { 20 TEST_F(GrabWindowSnapshotTest, TestGrabWindowSnapshot) {
29 // Launch a test window so we can take a snapshot. 21 // Launch a test window so we can take a snapshot.
30 NSRect frame = NSMakeRect(0, 0, 400, 400); 22 NSRect frame = NSMakeRect(0, 0, 400, 400);
31 scoped_nsobject<NSWindow> window( 23 scoped_nsobject<NSWindow> window(
32 [[NSWindow alloc] initWithContentRect:frame 24 [[NSWindow alloc] initWithContentRect:frame
(...skipping 20 matching lines...) Expand all
53 scaleFactor = [window backingScaleFactor]; 45 scaleFactor = [window backingScaleFactor];
54 EXPECT_EQ(400 * scaleFactor, CGImageGetWidth([rep CGImage])); 46 EXPECT_EQ(400 * scaleFactor, CGImageGetWidth([rep CGImage]));
55 NSColor* color = [rep colorAtX:200 * scaleFactor y:200 * scaleFactor]; 47 NSColor* color = [rep colorAtX:200 * scaleFactor y:200 * scaleFactor];
56 CGFloat red = 0, green = 0, blue = 0, alpha = 0; 48 CGFloat red = 0, green = 0, blue = 0, alpha = 0;
57 [color getRed:&red green:&green blue:&blue alpha:&alpha]; 49 [color getRed:&red green:&green blue:&blue alpha:&alpha];
58 EXPECT_GE(red + green + blue, 3.0); 50 EXPECT_GE(red + green + blue, 3.0);
59 } 51 }
60 52
61 } // namespace 53 } // namespace
62 } // namespace ui 54 } // namespace ui
OLDNEW
« no previous file with comments | « ui/gfx/screen_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698