OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/tabs/tab_strip_model.h" | 7 #include "chrome/browser/tabs/tab_strip_model.h" |
8 #import "chrome/browser/ui/browser_window.h" | 8 #import "chrome/browser/ui/browser_window.h" |
9 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 9 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
10 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 10 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
11 #include "content/browser/site_instance.h" | 11 #include "content/public/browser/site_instance.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 | 13 |
14 class TabposeWindowTest : public CocoaProfileTest { | 14 class TabposeWindowTest : public CocoaProfileTest { |
15 public: | 15 public: |
16 virtual void SetUp() { | 16 virtual void SetUp() { |
17 CocoaProfileTest::SetUp(); | 17 CocoaProfileTest::SetUp(); |
18 ASSERT_TRUE(profile()); | 18 ASSERT_TRUE(profile()); |
19 | 19 |
20 site_instance_ = SiteInstance::CreateSiteInstance(profile()); | 20 site_instance_ = content::SiteInstance::CreateSiteInstance(profile()); |
21 } | 21 } |
22 | 22 |
23 void AppendTabToStrip() { | 23 void AppendTabToStrip() { |
24 TabContentsWrapper* tab_contents = Browser::TabContentsFactory( | 24 TabContentsWrapper* tab_contents = Browser::TabContentsFactory( |
25 profile(), site_instance_, MSG_ROUTING_NONE, | 25 profile(), site_instance_, MSG_ROUTING_NONE, |
26 NULL, NULL); | 26 NULL, NULL); |
27 browser()->tabstrip_model()->AppendTabContents( | 27 browser()->tabstrip_model()->AppendTabContents( |
28 tab_contents, /*foreground=*/true); | 28 tab_contents, /*foreground=*/true); |
29 } | 29 } |
30 | 30 |
31 scoped_refptr<SiteInstance> site_instance_; | 31 scoped_refptr<content::SiteInstance> site_instance_; |
32 }; | 32 }; |
33 | 33 |
34 // Check that this doesn't leak. | 34 // Check that this doesn't leak. |
35 TEST_F(TabposeWindowTest, TestShow) { | 35 TEST_F(TabposeWindowTest, TestShow) { |
36 BrowserWindow* browser_window = CreateBrowserWindow(); | 36 BrowserWindow* browser_window = CreateBrowserWindow(); |
37 NSWindow* parent = browser_window->GetNativeHandle(); | 37 NSWindow* parent = browser_window->GetNativeHandle(); |
38 | 38 |
39 [parent orderFront:nil]; | 39 [parent orderFront:nil]; |
40 EXPECT_TRUE([parent isVisible]); | 40 EXPECT_TRUE([parent isVisible]); |
41 | 41 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 DCHECK_EQ([window selectedIndex], 0); | 105 DCHECK_EQ([window selectedIndex], 0); |
106 | 106 |
107 [window selectTileAtIndexWithoutAnimation:1]; | 107 [window selectTileAtIndexWithoutAnimation:1]; |
108 model->CloseTabContentsAt(0, TabStripModel::CLOSE_NONE); | 108 model->CloseTabContentsAt(0, TabStripModel::CLOSE_NONE); |
109 DCHECK_EQ([window thumbnailLayerCount], 1u); | 109 DCHECK_EQ([window thumbnailLayerCount], 1u); |
110 DCHECK_EQ([window selectedIndex], 0); | 110 DCHECK_EQ([window selectedIndex], 0); |
111 | 111 |
112 // Should release the window. | 112 // Should release the window. |
113 [window mouseDown:nil]; | 113 [window mouseDown:nil]; |
114 } | 114 } |
OLD | NEW |