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 <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
8 #include "base/mac/scoped_nsautorelease_pool.h" | 8 #include "base/mac/scoped_nsautorelease_pool.h" |
9 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | 9 #include "chrome/browser/media/media_capture_devices_dispatcher.h" |
10 #include "chrome/browser/media/media_stream_capture_indicator.h" | 10 #include "chrome/browser/media/media_stream_capture_indicator.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 - (TabController*)controller { | 82 - (TabController*)controller { |
83 return controller_; | 83 return controller_; |
84 } | 84 } |
85 | 85 |
86 @end | 86 @end |
87 | 87 |
88 namespace { | 88 namespace { |
89 | 89 |
90 class TabStripControllerTest : public CocoaProfileTest { | 90 class TabStripControllerTest : public CocoaProfileTest { |
91 public: | 91 public: |
92 virtual void SetUp() OVERRIDE { | 92 virtual void SetUp() override { |
93 CocoaProfileTest::SetUp(); | 93 CocoaProfileTest::SetUp(); |
94 ASSERT_TRUE(browser()); | 94 ASSERT_TRUE(browser()); |
95 | 95 |
96 NSWindow* window = browser()->window()->GetNativeWindow(); | 96 NSWindow* window = browser()->window()->GetNativeWindow(); |
97 NSView* parent = [window contentView]; | 97 NSView* parent = [window contentView]; |
98 NSRect content_frame = [parent frame]; | 98 NSRect content_frame = [parent frame]; |
99 | 99 |
100 // Create the "switch view" (view that gets changed out when a tab | 100 // Create the "switch view" (view that gets changed out when a tab |
101 // switches). | 101 // switches). |
102 NSRect switch_frame = NSMakeRect(0, 0, content_frame.size.width, 500); | 102 NSRect switch_frame = NSMakeRect(0, 0, content_frame.size.width, 500); |
(...skipping 17 matching lines...) Expand all Loading... |
120 delegate_.reset(new TestTabStripModelDelegate()); | 120 delegate_.reset(new TestTabStripModelDelegate()); |
121 model_ = browser()->tab_strip_model(); | 121 model_ = browser()->tab_strip_model(); |
122 controller_delegate_.reset([TestTabStripControllerDelegate alloc]); | 122 controller_delegate_.reset([TestTabStripControllerDelegate alloc]); |
123 controller_.reset([[TabStripController alloc] | 123 controller_.reset([[TabStripController alloc] |
124 initWithView:static_cast<TabStripView*>(tab_strip_.get()) | 124 initWithView:static_cast<TabStripView*>(tab_strip_.get()) |
125 switchView:switch_view.get() | 125 switchView:switch_view.get() |
126 browser:browser() | 126 browser:browser() |
127 delegate:controller_delegate_.get()]); | 127 delegate:controller_delegate_.get()]); |
128 } | 128 } |
129 | 129 |
130 virtual void TearDown() OVERRIDE { | 130 virtual void TearDown() override { |
131 // The call to CocoaTest::TearDown() deletes the Browser and TabStripModel | 131 // The call to CocoaTest::TearDown() deletes the Browser and TabStripModel |
132 // objects, so we first have to delete the controller, which refers to them. | 132 // objects, so we first have to delete the controller, which refers to them. |
133 controller_.reset(); | 133 controller_.reset(); |
134 model_ = NULL; | 134 model_ = NULL; |
135 CocoaProfileTest::TearDown(); | 135 CocoaProfileTest::TearDown(); |
136 } | 136 } |
137 | 137 |
138 TabView* CreateTab() { | 138 TabView* CreateTab() { |
139 SiteInstance* instance = SiteInstance::Create(profile()); | 139 SiteInstance* instance = SiteInstance::Create(profile()); |
140 WebContents* web_contents = WebContents::Create( | 140 WebContents* web_contents = WebContents::Create( |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 | 364 |
365 model_->ActivateTabAt(0, false); | 365 model_->ActivateTabAt(0, false); |
366 EXPECT_TRUE([tab1 controller].selected); | 366 EXPECT_TRUE([tab1 controller].selected); |
367 EXPECT_FALSE([tab2 controller].selected); | 367 EXPECT_FALSE([tab2 controller].selected); |
368 value = | 368 value = |
369 [tab_strip_ accessibilityAttributeValue:NSAccessibilityValueAttribute]; | 369 [tab_strip_ accessibilityAttributeValue:NSAccessibilityValueAttribute]; |
370 EXPECT_EQ(tab1, value); | 370 EXPECT_EQ(tab1, value); |
371 } | 371 } |
372 | 372 |
373 } // namespace | 373 } // namespace |
OLD | NEW |