| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/ui/cocoa/tabpose_window.h" | 5 #import "chrome/browser/ui/cocoa/tabpose_window.h" |
| 6 | 6 |
| 7 #import "chrome/browser/ui/browser_window.h" | 7 #import "chrome/browser/ui/browser_window.h" |
| 8 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 8 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
| 9 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 9 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 browser()->tab_strip_model()->AppendTabContents( | 29 browser()->tab_strip_model()->AppendTabContents( |
| 30 tab_contents, /*foreground=*/true); | 30 tab_contents, /*foreground=*/true); |
| 31 } | 31 } |
| 32 | 32 |
| 33 scoped_refptr<SiteInstance> site_instance_; | 33 scoped_refptr<SiteInstance> site_instance_; |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 // Check that this doesn't leak. | 36 // Check that this doesn't leak. |
| 37 TEST_F(TabposeWindowTest, TestShow) { | 37 TEST_F(TabposeWindowTest, TestShow) { |
| 38 BrowserWindow* browser_window = CreateBrowserWindow(); | 38 BrowserWindow* browser_window = CreateBrowserWindow(); |
| 39 NSWindow* parent = browser_window->GetNativeHandle(); | 39 NSWindow* parent = browser_window->GetNativeWindow(); |
| 40 | 40 |
| 41 [parent orderFront:nil]; | 41 [parent orderFront:nil]; |
| 42 EXPECT_TRUE([parent isVisible]); | 42 EXPECT_TRUE([parent isVisible]); |
| 43 | 43 |
| 44 // Add a few tabs to the tab strip model. | 44 // Add a few tabs to the tab strip model. |
| 45 for (int i = 0; i < 3; ++i) | 45 for (int i = 0; i < 3; ++i) |
| 46 AppendTabToStrip(); | 46 AppendTabToStrip(); |
| 47 | 47 |
| 48 base::mac::ScopedNSAutoreleasePool pool; | 48 base::mac::ScopedNSAutoreleasePool pool; |
| 49 TabposeWindow* window = | 49 TabposeWindow* window = |
| 50 [TabposeWindow openTabposeFor:parent | 50 [TabposeWindow openTabposeFor:parent |
| 51 rect:NSMakeRect(10, 20, 250, 160) | 51 rect:NSMakeRect(10, 20, 250, 160) |
| 52 slomo:NO | 52 slomo:NO |
| 53 tabStripModel:browser()->tab_strip_model()]; | 53 tabStripModel:browser()->tab_strip_model()]; |
| 54 | 54 |
| 55 // Should release the window. | 55 // Should release the window. |
| 56 [window mouseDown:nil]; | 56 [window mouseDown:nil]; |
| 57 } | 57 } |
| 58 | 58 |
| 59 TEST_F(TabposeWindowTest, TestModelObserver) { | 59 TEST_F(TabposeWindowTest, TestModelObserver) { |
| 60 BrowserWindow* browser_window = CreateBrowserWindow(); | 60 BrowserWindow* browser_window = CreateBrowserWindow(); |
| 61 NSWindow* parent = browser_window->GetNativeHandle(); | 61 NSWindow* parent = browser_window->GetNativeWindow(); |
| 62 [parent orderFront:nil]; | 62 [parent orderFront:nil]; |
| 63 | 63 |
| 64 // Add a few tabs to the tab strip model. | 64 // Add a few tabs to the tab strip model. |
| 65 for (int i = 0; i < 3; ++i) | 65 for (int i = 0; i < 3; ++i) |
| 66 AppendTabToStrip(); | 66 AppendTabToStrip(); |
| 67 | 67 |
| 68 base::mac::ScopedNSAutoreleasePool pool; | 68 base::mac::ScopedNSAutoreleasePool pool; |
| 69 TabposeWindow* window = | 69 TabposeWindow* window = |
| 70 [TabposeWindow openTabposeFor:parent | 70 [TabposeWindow openTabposeFor:parent |
| 71 rect:NSMakeRect(10, 20, 250, 160) | 71 rect:NSMakeRect(10, 20, 250, 160) |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 DCHECK_EQ([window selectedIndex], 0); | 107 DCHECK_EQ([window selectedIndex], 0); |
| 108 | 108 |
| 109 [window selectTileAtIndexWithoutAnimation:1]; | 109 [window selectTileAtIndexWithoutAnimation:1]; |
| 110 model->CloseTabContentsAt(0, TabStripModel::CLOSE_NONE); | 110 model->CloseTabContentsAt(0, TabStripModel::CLOSE_NONE); |
| 111 DCHECK_EQ([window thumbnailLayerCount], 1u); | 111 DCHECK_EQ([window thumbnailLayerCount], 1u); |
| 112 DCHECK_EQ([window selectedIndex], 0); | 112 DCHECK_EQ([window selectedIndex], 0); |
| 113 | 113 |
| 114 // Should release the window. | 114 // Should release the window. |
| 115 [window mouseDown:nil]; | 115 [window mouseDown:nil]; |
| 116 } | 116 } |
| OLD | NEW |