Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(823)

Side by Side Diff: chrome/browser/cocoa/tabpose_window_unittest.mm

Issue 3063031: Mac: more tabpose (Closed)
Patch Set: comments Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/cocoa/tabpose_window.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "chrome/browser/cocoa/tabpose_window.h" 5 #import "chrome/browser/cocoa/tabpose_window.h"
6 6
7 #include "base/scoped_nsobject.h" 7 #import "chrome/browser/browser_window.h"
8 #import "chrome/browser/cocoa/browser_test_helper.h" 8 #import "chrome/browser/cocoa/browser_test_helper.h"
9 #import "chrome/browser/cocoa/cocoa_test_helper.h" 9 #import "chrome/browser/cocoa/cocoa_test_helper.h"
10 #include "chrome/browser/renderer_host/site_instance.h"
11 #include "chrome/browser/tab_contents/tab_contents.h"
10 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
11 13
12 class TabposeWindowTest : public CocoaTest { 14 class TabposeWindowTest : public CocoaTest {
13 public: 15 public:
14 BrowserTestHelper browser_helper_; 16 BrowserTestHelper browser_helper_;
15 }; 17 };
16 18
17 // Check that this doesn't leak. 19 // Check that this doesn't leak.
18 TEST_F(TabposeWindowTest, TestShow) { 20 TEST_F(TabposeWindowTest, TestShow) {
19 scoped_nsobject<NSWindow> parent([[NSWindow alloc] 21 Browser* browser = browser_helper_.browser();
20 initWithContentRect:NSMakeRect(100, 200, 300, 200) 22 BrowserWindow* browser_window = browser_helper_.CreateBrowserWindow();
21 styleMask:NSTitledWindowMask 23 NSWindow* parent = browser_window->GetNativeHandle();
22 backing:NSBackingStoreBuffered 24
23 defer:NO]);
24 [parent orderFront:nil]; 25 [parent orderFront:nil];
25 EXPECT_TRUE([parent isVisible]); 26 EXPECT_TRUE([parent isVisible]);
26 27
28 // Add a few tabs to the tab strip model.
29 TabStripModel* model = browser->tabstrip_model();
30 SiteInstance* instance =
31 SiteInstance::CreateSiteInstance(browser_helper_.profile());
32 for (int i = 0; i < 3; ++i) {
33 TabContents* tab_contents =
34 new TabContents(browser_helper_.profile(), instance, MSG_ROUTING_NONE,
35 NULL);
36 model->AppendTabContents(tab_contents, /*foreground=*/true);
37 }
38
27 base::ScopedNSAutoreleasePool pool; 39 base::ScopedNSAutoreleasePool pool;
28 TabposeWindow* window = 40 TabposeWindow* window =
29 [TabposeWindow openTabposeFor:parent.get() 41 [TabposeWindow openTabposeFor:parent
30 rect:NSMakeRect(10, 20, 50, 60) 42 rect:NSMakeRect(10, 20, 250, 160)
31 slomo:NO]; 43 slomo:NO
44 tabStripModel:model];
32 45
33 // Should release the window. 46 // Should release the window.
34 [window mouseDown:nil]; 47 [window mouseDown:nil];
48
49 browser_helper_.CloseBrowserWindow();
35 } 50 }
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/tabpose_window.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698