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 #include "chrome/browser/ui/browser_tabstrip.h" | 7 #include "chrome/browser/ui/browser_tabstrip.h" |
8 #include "chrome/browser/ui/browser_window.h" | 8 #include "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.h" | 10 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
11 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 11 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
12 #include "content/public/browser/site_instance.h" | 12 #include "content/public/browser/site_instance.h" |
13 #include "ipc/ipc_message.h" | 13 #include "ipc/ipc_message.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 | 15 |
16 using content::SiteInstance; | 16 using content::SiteInstance; |
17 | 17 |
18 class TabposeWindowTest : public CocoaProfileTest { | 18 class TabposeWindowTest : public CocoaProfileTest { |
19 public: | 19 public: |
20 virtual void SetUp() { | 20 virtual void SetUp() { |
21 CocoaProfileTest::SetUp(); | 21 CocoaProfileTest::SetUp(); |
22 ASSERT_TRUE(profile()); | 22 ASSERT_TRUE(profile()); |
23 | 23 |
24 site_instance_ = SiteInstance::Create(profile()); | 24 site_instance_ = SiteInstance::Create(profile()); |
25 } | 25 } |
26 | 26 |
27 void AppendTabToStrip() { | 27 void AppendTabToStrip() { |
28 TabContents* tab_contents = chrome::TabContentsFactory( | 28 TabContents* tab_contents = chrome::TabContentsFactory( |
29 profile(), site_instance_, MSG_ROUTING_NONE, NULL, NULL); | 29 profile(), site_instance_, MSG_ROUTING_NONE, 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 NSWindow* parent = browser()->window()->GetNativeWindow(); | 39 NSWindow* parent = browser()->window()->GetNativeWindow(); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 DCHECK_EQ([window selectedIndex], 0); | 106 DCHECK_EQ([window selectedIndex], 0); |
107 | 107 |
108 [window selectTileAtIndexWithoutAnimation:1]; | 108 [window selectTileAtIndexWithoutAnimation:1]; |
109 model->CloseTabContentsAt(0, TabStripModel::CLOSE_NONE); | 109 model->CloseTabContentsAt(0, TabStripModel::CLOSE_NONE); |
110 DCHECK_EQ([window thumbnailLayerCount], 1u); | 110 DCHECK_EQ([window thumbnailLayerCount], 1u); |
111 DCHECK_EQ([window selectedIndex], 0); | 111 DCHECK_EQ([window selectedIndex], 0); |
112 | 112 |
113 // Should release the window. | 113 // Should release the window. |
114 [window mouseDown:nil]; | 114 [window mouseDown:nil]; |
115 } | 115 } |
OLD | NEW |