Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / first_run_bubble_controller_unittest.mm
blob6dbf7dc36e931fff2f58a7d1c40985c939040b81
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"
15 namespace {
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
26                                       defer:NO]);
27   [parent setReleasedWhenClosed:NO];
28   if (base::debug::BeingDebugged())
29     [parent.get() orderFront:nil];
30   else
31     [parent.get() orderBack:nil];
33   FirstRunBubbleController* controller = [FirstRunBubbleController
34       showForView:[parent.get() contentView]
35            offset:NSMakePoint(300, 300)
36           browser:NULL
37           profile:profile()];
38   EXPECT_TRUE(controller != nil);
39   EXPECT_TRUE([[controller window] isVisible]);
40   [parent.get() close];
43 }  // namespace