summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/tabpose_window_unittest.mm
blob: 8f6f239cd1c5cf0d558e025da863bd0aa0e8db5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#import "chrome/browser/cocoa/tabpose_window.h"

#include "base/scoped_nsobject.h"
#import "chrome/browser/cocoa/browser_test_helper.h"
#import "chrome/browser/cocoa/cocoa_test_helper.h"
#include "testing/gtest/include/gtest/gtest.h"

class TabposeWindowTest : public CocoaTest {
 public:
  BrowserTestHelper browser_helper_;
};

// Check that this doesn't leak.
TEST_F(TabposeWindowTest, TestShow) {
  scoped_nsobject<NSWindow> parent([[NSWindow alloc]
      initWithContentRect:NSMakeRect(100, 200, 300, 200)
                styleMask:NSTitledWindowMask
                  backing:NSBackingStoreBuffered
                    defer:NO]);
  [parent orderFront:nil];
  EXPECT_TRUE([parent isVisible]);

  base::ScopedNSAutoreleasePool pool;
  TabposeWindow* window =
      [TabposeWindow openTabposeFor:parent.get()
                               rect:NSMakeRect(10, 20, 50, 60)
                              slomo:NO];

  // Should release the window.
  [window mouseDown:nil];
}