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 #include "chrome/browser/ui/browser_tabstrip.h" |
| 8 #include "chrome/browser/ui/browser_window.h" |
8 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 9 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
9 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 10 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
10 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 11 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
11 #include "content/public/browser/site_instance.h" | 12 #include "content/public/browser/site_instance.h" |
12 #include "ipc/ipc_message.h" | 13 #include "ipc/ipc_message.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
14 | 15 |
15 using content::SiteInstance; | 16 using content::SiteInstance; |
16 | 17 |
17 class TabposeWindowTest : public CocoaProfileTest { | 18 class TabposeWindowTest : public CocoaProfileTest { |
18 public: | 19 public: |
19 virtual void SetUp() { | 20 virtual void SetUp() { |
20 CocoaProfileTest::SetUp(); | 21 CocoaProfileTest::SetUp(); |
21 ASSERT_TRUE(profile()); | 22 ASSERT_TRUE(profile()); |
22 | 23 |
23 site_instance_ = SiteInstance::Create(profile()); | 24 site_instance_ = SiteInstance::Create(profile()); |
24 } | 25 } |
25 | 26 |
26 void AppendTabToStrip() { | 27 void AppendTabToStrip() { |
27 TabContents* tab_contents = Browser::TabContentsFactory( | 28 TabContents* tab_contents = chrome::TabContentsFactory( |
28 profile(), site_instance_, MSG_ROUTING_NONE, | 29 profile(), site_instance_, MSG_ROUTING_NONE, NULL, NULL); |
29 NULL, NULL); | |
30 browser()->tab_strip_model()->AppendTabContents( | 30 browser()->tab_strip_model()->AppendTabContents( |
31 tab_contents, /*foreground=*/true); | 31 tab_contents, /*foreground=*/true); |
32 } | 32 } |
33 | 33 |
34 scoped_refptr<SiteInstance> site_instance_; | 34 scoped_refptr<SiteInstance> site_instance_; |
35 }; | 35 }; |
36 | 36 |
37 // Check that this doesn't leak. | 37 // Check that this doesn't leak. |
38 TEST_F(TabposeWindowTest, TestShow) { | 38 TEST_F(TabposeWindowTest, TestShow) { |
39 BrowserWindow* browser_window = CreateBrowserWindow(); | 39 BrowserWindow* browser_window = CreateBrowserWindow(); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 DCHECK_EQ([window selectedIndex], 0); | 108 DCHECK_EQ([window selectedIndex], 0); |
109 | 109 |
110 [window selectTileAtIndexWithoutAnimation:1]; | 110 [window selectTileAtIndexWithoutAnimation:1]; |
111 model->CloseTabContentsAt(0, TabStripModel::CLOSE_NONE); | 111 model->CloseTabContentsAt(0, TabStripModel::CLOSE_NONE); |
112 DCHECK_EQ([window thumbnailLayerCount], 1u); | 112 DCHECK_EQ([window thumbnailLayerCount], 1u); |
113 DCHECK_EQ([window selectedIndex], 0); | 113 DCHECK_EQ([window selectedIndex], 0); |
114 | 114 |
115 // Should release the window. | 115 // Should release the window. |
116 [window mouseDown:nil]; | 116 [window mouseDown:nil]; |
117 } | 117 } |
OLD | NEW |