OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #include "chrome/browser/cocoa/browser_test_helper.h" | 7 #include "chrome/browser/cocoa/browser_test_helper.h" |
8 #import "chrome/browser/cocoa/cocoa_test_helper.h" | 8 #import "chrome/browser/cocoa/cocoa_test_helper.h" |
9 #import "chrome/browser/cocoa/tab_strip_controller.h" | 9 #import "chrome/browser/cocoa/tab_strip_controller.h" |
10 #include "chrome/browser/tab_contents/tab_contents.h" | 10 #include "chrome/browser/tab_contents/tab_contents.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 #include "testing/platform_test.h" |
12 | 13 |
13 namespace { | 14 namespace { |
14 | 15 |
15 // Stub model delegate | 16 // Stub model delegate |
16 class TestTabStripDelegate : public TabStripModelDelegate { | 17 class TestTabStripDelegate : public TabStripModelDelegate { |
17 public: | 18 public: |
18 virtual TabContents* AddBlankTab(bool foreground) { | 19 virtual TabContents* AddBlankTab(bool foreground) { |
19 return NULL; | 20 return NULL; |
20 } | 21 } |
21 virtual TabContents* AddBlankTabAt(int index, bool foreground) { | 22 virtual TabContents* AddBlankTabAt(int index, bool foreground) { |
(...skipping 28 matching lines...) Expand all Loading... |
50 return true; | 51 return true; |
51 } | 52 } |
52 virtual bool CanRestoreTab() { | 53 virtual bool CanRestoreTab() { |
53 return true; | 54 return true; |
54 } | 55 } |
55 virtual void RestoreTab() { } | 56 virtual void RestoreTab() { } |
56 | 57 |
57 virtual bool CanCloseContentsAt(int index) { return true; } | 58 virtual bool CanCloseContentsAt(int index) { return true; } |
58 }; | 59 }; |
59 | 60 |
60 class TabStripControllerTest : public testing::Test { | 61 class TabStripControllerTest : public PlatformTest { |
61 public: | 62 public: |
62 TabStripControllerTest() { | 63 TabStripControllerTest() { |
63 NSView* parent = cocoa_helper_.contentView(); | 64 NSView* parent = cocoa_helper_.contentView(); |
64 NSRect content_frame = [parent frame]; | 65 NSRect content_frame = [parent frame]; |
65 | 66 |
66 // Create the "switch view" (view that gets changed out when a tab | 67 // Create the "switch view" (view that gets changed out when a tab |
67 // switches). | 68 // switches). |
68 NSRect switch_frame = NSMakeRect(0, 0, content_frame.size.width, 500); | 69 NSRect switch_frame = NSMakeRect(0, 0, content_frame.size.width, 500); |
69 scoped_nsobject<NSView> switch_view([[NSView alloc] | 70 scoped_nsobject<NSView> switch_view([[NSView alloc] |
70 initWithFrame:switch_frame]); | 71 initWithFrame:switch_frame]); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 } | 125 } |
125 | 126 |
126 // Test that changing the number of tabs broadcasts a | 127 // Test that changing the number of tabs broadcasts a |
127 // kTabStripNumberOfTabsChanged notifiction. | 128 // kTabStripNumberOfTabsChanged notifiction. |
128 TEST_F(TabStripControllerTest, Notifications) { | 129 TEST_F(TabStripControllerTest, Notifications) { |
129 // TODO(pinkerton): Creating a TabContents crashes an unrelated test, even | 130 // TODO(pinkerton): Creating a TabContents crashes an unrelated test, even |
130 // if you don't do anything with it. http://crbug.com/10899 | 131 // if you don't do anything with it. http://crbug.com/10899 |
131 } | 132 } |
132 | 133 |
133 } // namespace | 134 } // namespace |
OLD | NEW |