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 "base/mac/mac_util.h" | 7 #include "base/mac/mac_util.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/tabs/tab_strip_model.h" | 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
11 #include "content/public/browser/site_instance.h" | 11 #include "content/public/browser/site_instance.h" |
12 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
15 using content::SiteInstance; | 15 using content::SiteInstance; |
16 | 16 |
17 class TabposeWindowTest : public CocoaProfileTest { | 17 class TabposeWindowTest : public CocoaProfileTest { |
18 public: | 18 public: |
19 virtual void SetUp() { | 19 virtual void SetUp() { |
20 CocoaProfileTest::SetUp(); | 20 CocoaProfileTest::SetUp(); |
21 ASSERT_TRUE(profile()); | 21 ASSERT_TRUE(profile()); |
22 | 22 |
23 site_instance_ = SiteInstance::Create(profile()); | 23 site_instance_ = SiteInstance::Create(profile()); |
24 } | 24 } |
25 | 25 |
26 void AppendTabToStrip() { | 26 void AppendTabToStrip() { |
27 content::WebContents* web_contents = content::WebContents::Create( | 27 content::WebContents* web_contents = content::WebContents::Create( |
28 content::WebContents::CreateParams(profile(), site_instance_)); | 28 content::WebContents::CreateParams(profile(), site_instance_.get())); |
29 browser()->tab_strip_model()->AppendWebContents( | 29 browser()->tab_strip_model()->AppendWebContents( |
30 web_contents, /*foreground=*/true); | 30 web_contents, /*foreground=*/true); |
31 } | 31 } |
32 | 32 |
33 scoped_refptr<SiteInstance> site_instance_; | 33 scoped_refptr<SiteInstance> site_instance_; |
34 }; | 34 }; |
35 | 35 |
36 TEST_F(TabposeWindowTest, TestShow) { | 36 TEST_F(TabposeWindowTest, TestShow) { |
37 // Skip this test on 10.7 | 37 // Skip this test on 10.7 |
38 // http://code.google.com/p/chromium/issues/detail?id=127845 | 38 // http://code.google.com/p/chromium/issues/detail?id=127845 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 DCHECK_EQ([window selectedIndex], 0); | 116 DCHECK_EQ([window selectedIndex], 0); |
117 | 117 |
118 [window selectTileAtIndexWithoutAnimation:1]; | 118 [window selectTileAtIndexWithoutAnimation:1]; |
119 model->CloseWebContentsAt(0, TabStripModel::CLOSE_NONE); | 119 model->CloseWebContentsAt(0, TabStripModel::CLOSE_NONE); |
120 DCHECK_EQ([window thumbnailLayerCount], 1u); | 120 DCHECK_EQ([window thumbnailLayerCount], 1u); |
121 DCHECK_EQ([window selectedIndex], 0); | 121 DCHECK_EQ([window selectedIndex], 0); |
122 | 122 |
123 // Should release the window. | 123 // Should release the window. |
124 [window mouseDown:nil]; | 124 [window mouseDown:nil]; |
125 } | 125 } |
OLD | NEW |