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