OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/cocoa/first_run_bubble_controller.h" | 5 #import "chrome/browser/ui/cocoa/first_run_bubble_controller.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 | 8 |
9 #include "base/debug/debugger.h" | 9 #include "base/debug/debugger.h" |
10 #include "base/memory/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
11 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 11 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 class FirstRunBubbleControllerTest : public CocoaProfileTest { | 16 class FirstRunBubbleControllerTest : public CocoaProfileTest { |
17 }; | 17 }; |
18 | 18 |
19 // Check that the bubble doesn't crash or leak. | 19 // Check that the bubble doesn't crash or leak. |
20 TEST_F(FirstRunBubbleControllerTest, Init) { | 20 TEST_F(FirstRunBubbleControllerTest, Init) { |
21 scoped_nsobject<NSWindow> parent([[NSWindow alloc] | 21 base::scoped_nsobject<NSWindow> parent( |
22 initWithContentRect:NSMakeRect(0, 0, 800, 600) | 22 [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 800, 600) |
23 styleMask:NSBorderlessWindowMask | 23 styleMask:NSBorderlessWindowMask |
24 backing:NSBackingStoreBuffered | 24 backing:NSBackingStoreBuffered |
25 defer:NO]); | 25 defer:NO]); |
26 [parent setReleasedWhenClosed:NO]; | 26 [parent setReleasedWhenClosed:NO]; |
27 if (base::debug::BeingDebugged()) | 27 if (base::debug::BeingDebugged()) |
28 [parent.get() orderFront:nil]; | 28 [parent.get() orderFront:nil]; |
29 else | 29 else |
30 [parent.get() orderBack:nil]; | 30 [parent.get() orderBack:nil]; |
31 | 31 |
32 FirstRunBubbleController* controller = [FirstRunBubbleController | 32 FirstRunBubbleController* controller = [FirstRunBubbleController |
33 showForView:[parent.get() contentView] | 33 showForView:[parent.get() contentView] |
34 offset:NSMakePoint(300, 300) | 34 offset:NSMakePoint(300, 300) |
35 browser:NULL | 35 browser:NULL |
36 profile:profile()]; | 36 profile:profile()]; |
37 EXPECT_TRUE(controller != nil); | 37 EXPECT_TRUE(controller != nil); |
38 EXPECT_TRUE([[controller window] isVisible]); | 38 EXPECT_TRUE([[controller window] isVisible]); |
39 [parent.get() close]; | 39 [parent.get() close]; |
40 } | 40 } |
41 | 41 |
42 } // namespace | 42 } // namespace |
OLD | NEW |