OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "chrome/browser/cocoa/cocoa_test_helper.h" | 5 #import "chrome/browser/cocoa/cocoa_test_helper.h" |
| 6 #import "chrome/browser/chrome_browser_application_mac.h" |
6 #import "base/logging.h" | 7 #import "base/logging.h" |
7 | 8 |
8 @implementation CocoaTestHelperWindow | 9 @implementation CocoaTestHelperWindow |
9 | 10 |
10 - (id)initWithContentRect:(NSRect)contentRect { | 11 - (id)initWithContentRect:(NSRect)contentRect { |
11 return [self initWithContentRect:contentRect | 12 return [self initWithContentRect:contentRect |
12 styleMask:NSBorderlessWindowMask | 13 styleMask:NSBorderlessWindowMask |
13 backing:NSBackingStoreBuffered | 14 backing:NSBackingStoreBuffered |
14 defer:NO]; | 15 defer:NO]; |
15 } | 16 } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 } | 62 } |
62 | 63 |
63 void CocoaTest::BootstrapCocoa() { | 64 void CocoaTest::BootstrapCocoa() { |
64 // Look in the framework bundle for resources. | 65 // Look in the framework bundle for resources. |
65 FilePath path; | 66 FilePath path; |
66 PathService::Get(base::DIR_EXE, &path); | 67 PathService::Get(base::DIR_EXE, &path); |
67 path = path.Append(chrome::kFrameworkName); | 68 path = path.Append(chrome::kFrameworkName); |
68 mac_util::SetOverrideAppBundlePath(path); | 69 mac_util::SetOverrideAppBundlePath(path); |
69 | 70 |
70 // Bootstrap Cocoa. It's very unhappy without this. | 71 // Bootstrap Cocoa. It's very unhappy without this. |
71 [NSApplication sharedApplication]; | 72 [CrApplication sharedApplication]; |
72 } | 73 } |
73 | 74 |
74 void CocoaTest::TearDown() { | 75 void CocoaTest::TearDown() { |
75 called_tear_down_ = true; | 76 called_tear_down_ = true; |
76 // Call close on our test_window to clean it up if one was opened. | 77 // Call close on our test_window to clean it up if one was opened. |
77 [test_window_ close]; | 78 [test_window_ close]; |
78 test_window_ = nil; | 79 test_window_ = nil; |
79 | 80 |
80 // Recycle the pool to clean up any stuff that was put on the | 81 // Recycle the pool to clean up any stuff that was put on the |
81 // autorelease pool due to window or windowcontroller closures. | 82 // autorelease pool due to window or windowcontroller closures. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 if (!test_window_) { | 148 if (!test_window_) { |
148 test_window_ = [[CocoaTestHelperWindow alloc] init]; | 149 test_window_ = [[CocoaTestHelperWindow alloc] init]; |
149 if (DebugUtil::BeingDebugged()) { | 150 if (DebugUtil::BeingDebugged()) { |
150 [test_window_ orderFront:nil]; | 151 [test_window_ orderFront:nil]; |
151 } else { | 152 } else { |
152 [test_window_ orderBack:nil]; | 153 [test_window_ orderBack:nil]; |
153 } | 154 } |
154 } | 155 } |
155 return test_window_; | 156 return test_window_; |
156 } | 157 } |
OLD | NEW |