1// Copyright (c) 2012 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.
4
5#import <Cocoa/Cocoa.h>
6
7#include "base/debug/debugger.h"
8#include "chrome/app/chrome_command_ids.h"
9#import "chrome/browser/ui/cocoa/chrome_browser_window.h"
10#import "chrome/browser/ui/cocoa/cocoa_test_helper.h"
11#include "testing/gtest/include/gtest/gtest.h"
12#import "testing/gtest_mac.h"
13#include "testing/platform_test.h"
14
15class ChromeBrowserWindowTest : public CocoaTest {
16 public:
17  virtual void SetUp() {
18    CocoaTest::SetUp();
19    // Create a window.
20    const NSUInteger mask = NSTitledWindowMask | NSClosableWindowMask |
21        NSMiniaturizableWindowMask | NSResizableWindowMask;
22    window_ = [[ChromeBrowserWindow alloc]
23               initWithContentRect:NSMakeRect(0, 0, 800, 600)
24               styleMask:mask
25               backing:NSBackingStoreBuffered
26               defer:NO];
27    if (base::debug::BeingDebugged()) {
28      [window_ orderFront:nil];
29    } else {
30      [window_ orderBack:nil];
31    }
32  }
33
34  virtual void TearDown() {
35    [window_ close];
36    CocoaTest::TearDown();
37  }
38
39  ChromeBrowserWindow* window_;
40};
41
42// Baseline test that the window creates, displays, closes, and
43// releases.
44TEST_F(ChromeBrowserWindowTest, ShowAndClose) {
45  [window_ display];
46}
47
48