| 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 "chrome/browser/ui/browser_tabstrip.h" | 8 #include "chrome/browser/ui/browser_tabstrip.h" |
| 8 #include "chrome/browser/ui/browser_window.h" | 9 #include "chrome/browser/ui/browser_window.h" |
| 9 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 10 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
| 10 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 11 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 11 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 12 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 12 #include "content/public/browser/site_instance.h" | 13 #include "content/public/browser/site_instance.h" |
| 13 #include "ipc/ipc_message.h" | 14 #include "ipc/ipc_message.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 16 |
| 16 using content::SiteInstance; | 17 using content::SiteInstance; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 27 void AppendTabToStrip() { | 28 void AppendTabToStrip() { |
| 28 TabContents* tab_contents = chrome::TabContentsFactory( | 29 TabContents* tab_contents = chrome::TabContentsFactory( |
| 29 profile(), site_instance_, MSG_ROUTING_NONE, NULL); | 30 profile(), site_instance_, MSG_ROUTING_NONE, NULL); |
| 30 browser()->tab_strip_model()->AppendTabContents( | 31 browser()->tab_strip_model()->AppendTabContents( |
| 31 tab_contents, /*foreground=*/true); | 32 tab_contents, /*foreground=*/true); |
| 32 } | 33 } |
| 33 | 34 |
| 34 scoped_refptr<SiteInstance> site_instance_; | 35 scoped_refptr<SiteInstance> site_instance_; |
| 35 }; | 36 }; |
| 36 | 37 |
| 37 // Check that this doesn't leak. | |
| 38 TEST_F(TabposeWindowTest, TestShow) { | 38 TEST_F(TabposeWindowTest, TestShow) { |
| 39 // Skip this test on 10.7 |
| 40 // http://code.google.com/p/chromium/issues/detail?id=127845 |
| 41 if (IsOSLionOrLater()) { |
| 42 return; |
| 43 } |
| 44 |
| 39 NSWindow* parent = browser()->window()->GetNativeWindow(); | 45 NSWindow* parent = browser()->window()->GetNativeWindow(); |
| 40 | 46 |
| 41 [parent orderFront:nil]; | 47 [parent orderFront:nil]; |
| 42 EXPECT_TRUE([parent isVisible]); | 48 EXPECT_TRUE([parent isVisible]); |
| 43 | 49 |
| 44 // Add a few tabs to the tab strip model. | 50 // Add a few tabs to the tab strip model. |
| 45 for (int i = 0; i < 3; ++i) | 51 for (int i = 0; i < 3; ++i) |
| 46 AppendTabToStrip(); | 52 AppendTabToStrip(); |
| 47 | 53 |
| 48 base::mac::ScopedNSAutoreleasePool pool; | 54 base::mac::ScopedNSAutoreleasePool pool; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 DCHECK_EQ([window selectedIndex], 0); | 112 DCHECK_EQ([window selectedIndex], 0); |
| 107 | 113 |
| 108 [window selectTileAtIndexWithoutAnimation:1]; | 114 [window selectTileAtIndexWithoutAnimation:1]; |
| 109 model->CloseTabContentsAt(0, TabStripModel::CLOSE_NONE); | 115 model->CloseTabContentsAt(0, TabStripModel::CLOSE_NONE); |
| 110 DCHECK_EQ([window thumbnailLayerCount], 1u); | 116 DCHECK_EQ([window thumbnailLayerCount], 1u); |
| 111 DCHECK_EQ([window selectedIndex], 0); | 117 DCHECK_EQ([window selectedIndex], 0); |
| 112 | 118 |
| 113 // Should release the window. | 119 // Should release the window. |
| 114 [window mouseDown:nil]; | 120 [window mouseDown:nil]; |
| 115 } | 121 } |
| OLD | NEW |