OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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" | |
11 #include "base/file_path.h" | 10 #include "base/file_path.h" |
12 #include "base/file_util.h" | 11 #include "base/file_util.h" |
13 #include "base/mac/scoped_cftyperef.h" | 12 #include "base/mac/scoped_cftyperef.h" |
| 13 #include "base/test/mock_chrome_application_mac.h" |
14 #include "base/scoped_nsobject.h" | 14 #include "base/scoped_nsobject.h" |
15 #include "base/scoped_ptr.h" | 15 #include "base/scoped_ptr.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 #include "testing/platform_test.h" | 17 #include "testing/platform_test.h" |
18 | 18 |
19 namespace mac_util { | 19 namespace mac_util { |
20 | 20 |
21 namespace { | 21 namespace { |
22 | 22 |
23 typedef PlatformTest MacUtilTest; | 23 typedef PlatformTest MacUtilTest; |
(...skipping 23 matching lines...) Expand all Loading... |
47 } | 47 } |
48 | 48 |
49 TEST_F(MacUtilTest, TestLibraryPath) { | 49 TEST_F(MacUtilTest, TestLibraryPath) { |
50 FilePath library_dir = GetUserLibraryPath(); | 50 FilePath library_dir = GetUserLibraryPath(); |
51 // Make sure the string isn't empty. | 51 // Make sure the string isn't empty. |
52 EXPECT_FALSE(library_dir.value().empty()); | 52 EXPECT_FALSE(library_dir.value().empty()); |
53 } | 53 } |
54 | 54 |
55 TEST_F(MacUtilTest, TestGrabWindowSnapshot) { | 55 TEST_F(MacUtilTest, TestGrabWindowSnapshot) { |
56 // Launch a test window so we can take a snapshot. | 56 // Launch a test window so we can take a snapshot. |
57 [CrApplication sharedApplication]; | 57 [MockCrApp sharedApplication]; |
58 NSRect frame = NSMakeRect(0, 0, 400, 400); | 58 NSRect frame = NSMakeRect(0, 0, 400, 400); |
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( |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 mac_util::NSObjectRetain(array); | 187 mac_util::NSObjectRetain(array); |
188 EXPECT_EQ(2U, [array retainCount]); | 188 EXPECT_EQ(2U, [array retainCount]); |
189 | 189 |
190 mac_util::NSObjectRelease(array); | 190 mac_util::NSObjectRelease(array); |
191 EXPECT_EQ(1U, [array retainCount]); | 191 EXPECT_EQ(1U, [array retainCount]); |
192 } | 192 } |
193 | 193 |
194 } // namespace | 194 } // namespace |
195 | 195 |
196 } // namespace mac_util | 196 } // namespace mac_util |
OLD | NEW |