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

Side by Side Diff: base/mac_util_unittest.mm

Issue 2068004: Commiting http://codereview.chromium.org/2017007/show on behalf of rkc@chromi... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 7 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
OLDNEW
1 // Copyright (c) 2008-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2008-2009 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 #include <vector> 6 #include <vector>
7 7
8 #include "base/mac_util.h" 8 #include "base/mac_util.h"
9 9
10 #import "base/chrome_application_mac.h" 10 #import "base/chrome_application_mac.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 scoped_nsobject<NSWindow> window( 59 scoped_nsobject<NSWindow> window(
60 [[NSWindow alloc] initWithContentRect:frame 60 [[NSWindow alloc] initWithContentRect:frame
61 styleMask:NSBorderlessWindowMask 61 styleMask:NSBorderlessWindowMask
62 backing:NSBackingStoreBuffered 62 backing:NSBackingStoreBuffered
63 defer:NO]); 63 defer:NO]);
64 [window setBackgroundColor:[NSColor whiteColor]]; 64 [window setBackgroundColor:[NSColor whiteColor]];
65 [window makeKeyAndOrderFront:NSApp]; 65 [window makeKeyAndOrderFront:NSApp];
66 66
67 scoped_ptr<std::vector<unsigned char> > png_representation( 67 scoped_ptr<std::vector<unsigned char> > png_representation(
68 new std::vector<unsigned char>); 68 new std::vector<unsigned char>);
69 GrabWindowSnapshot(window, png_representation.get()); 69 int width, height;
70 GrabWindowSnapshot(window, png_representation.get(),
71 &width, &height);
70 72
71 // Copy png back into NSData object so we can make sure we grabbed a png. 73 // Copy png back into NSData object so we can make sure we grabbed a png.
72 scoped_nsobject<NSData> image_data( 74 scoped_nsobject<NSData> image_data(
73 [[NSData alloc] initWithBytes:&(*png_representation)[0] 75 [[NSData alloc] initWithBytes:&(*png_representation)[0]
74 length:png_representation->size()]); 76 length:png_representation->size()]);
75 NSBitmapImageRep* rep = [NSBitmapImageRep imageRepWithData:image_data.get()]; 77 NSBitmapImageRep* rep = [NSBitmapImageRep imageRepWithData:image_data.get()];
76 EXPECT_TRUE([rep isKindOfClass:[NSBitmapImageRep class]]); 78 EXPECT_TRUE([rep isKindOfClass:[NSBitmapImageRep class]]);
77 EXPECT_TRUE(CGImageGetWidth([rep CGImage]) == 400); 79 EXPECT_TRUE(CGImageGetWidth([rep CGImage]) == 400);
78 NSColor* color = [rep colorAtX:200 y:200]; 80 NSColor* color = [rep colorAtX:200 y:200];
79 CGFloat red = 0, green = 0, blue = 0, alpha = 0; 81 CGFloat red = 0, green = 0, blue = 0, alpha = 0;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 GetValueFromDictionary( 161 GetValueFromDictionary(
160 dict, CFSTR("key"), CFStringGetTypeID()))); 162 dict, CFSTR("key"), CFStringGetTypeID())));
161 EXPECT_FALSE(GetValueFromDictionary(dict, CFSTR("key"), CFNumberGetTypeID())); 163 EXPECT_FALSE(GetValueFromDictionary(dict, CFSTR("key"), CFNumberGetTypeID()));
162 EXPECT_FALSE(GetValueFromDictionary( 164 EXPECT_FALSE(GetValueFromDictionary(
163 dict, CFSTR("no-exist"), CFStringGetTypeID())); 165 dict, CFSTR("no-exist"), CFStringGetTypeID()));
164 } 166 }
165 167
166 } // namespace 168 } // namespace
167 169
168 } // namespace mac_util 170 } // namespace mac_util
OLDNEW
« no previous file with comments | « base/mac_util.mm ('k') | chrome/app/generated_resources.grd » ('j') | chrome/chrome_browser.gypi » ('J')

Powered by Google App Engine
This is Rietveld 408576698