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
3 // found in the LICENSE file.
5 #import "chrome/browser/ui/cocoa/first_run_bubble_controller.h"
7 #import <Cocoa/Cocoa.h>
9 #include "base/debug/debugger.h"
10 #include "base/mac/scoped_nsobject.h"
11 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h"
12 #include "chrome/test/base/testing_profile.h"
13 #include "testing/gtest/include/gtest/gtest.h"
17 class FirstRunBubbleControllerTest : public CocoaProfileTest {
20 // Check that the bubble doesn't crash or leak.
21 TEST_F(FirstRunBubbleControllerTest, Init) {
22 base::scoped_nsobject<NSWindow> parent(
23 [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 800, 600)
24 styleMask:NSBorderlessWindowMask
25 backing:NSBackingStoreBuffered
27 [parent setReleasedWhenClosed:NO];
28 if (base::debug::BeingDebugged())
29 [parent.get() orderFront:nil];
31 [parent.get() orderBack:nil];
33 FirstRunBubbleController* controller = [FirstRunBubbleController
34 showForView:[parent.get() contentView]
35 offset:NSMakePoint(300, 300)
38 EXPECT_TRUE(controller != nil);
39 EXPECT_TRUE([[controller window] isVisible]);