Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(497)

Side by Side Diff: chrome/browser/ui/cocoa/tabs/tab_strip_controller_unittest.mm

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 // Simulate a close of the browser window. 182 // Simulate a close of the browser window.
183 model_->CloseAllTabs(); 183 model_->CloseAllTabs();
184 controller_.reset(); 184 controller_.reset();
185 tab_strip_.reset(); 185 tab_strip_.reset();
186 // Schedule a NSLeftMouseUp to end the nested drag event loop. 186 // Schedule a NSLeftMouseUp to end the nested drag event loop.
187 NSEvent* event = 187 NSEvent* event =
188 cocoa_test_event_utils::MouseEventWithType(NSLeftMouseUp, 0); 188 cocoa_test_event_utils::MouseEventWithType(NSLeftMouseUp, 0);
189 [NSApp postEvent:event atStart:NO]; 189 [NSApp postEvent:event atStart:NO];
190 } 190 }
191 191
192 scoped_ptr<TestTabStripModelDelegate> delegate_; 192 std::unique_ptr<TestTabStripModelDelegate> delegate_;
193 TabStripModel* model_; 193 TabStripModel* model_;
194 base::scoped_nsobject<TestTabStripControllerDelegate> controller_delegate_; 194 base::scoped_nsobject<TestTabStripControllerDelegate> controller_delegate_;
195 base::scoped_nsobject<TabStripController> controller_; 195 base::scoped_nsobject<TabStripController> controller_;
196 base::scoped_nsobject<TabStripView> tab_strip_; 196 base::scoped_nsobject<TabStripView> tab_strip_;
197 base::scoped_nsobject<NSView> switch_view_; 197 base::scoped_nsobject<NSView> switch_view_;
198 }; 198 };
199 199
200 // Test adding and removing tabs and making sure that views get added to 200 // Test adding and removing tabs and making sure that views get added to
201 // the tab strip. 201 // the tab strip.
202 TEST_F(TabStripControllerTest, AddRemoveTabs) { 202 TEST_F(TabStripControllerTest, AddRemoveTabs) {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 EXPECT_NSEQ(baseTitle, [tabController toolTip]); 288 EXPECT_NSEQ(baseTitle, [tabController toolTip]);
289 289
290 // Simulate the start of tab video capture. Tab title remains the same, but 290 // Simulate the start of tab video capture. Tab title remains the same, but
291 // the tooltip text should include the following appended: 1) a line break; 291 // the tooltip text should include the following appended: 1) a line break;
292 // 2) a non-empty string with a localized description of the alert state. 292 // 2) a non-empty string with a localized description of the alert state.
293 scoped_refptr<MediaStreamCaptureIndicator> indicator = 293 scoped_refptr<MediaStreamCaptureIndicator> indicator =
294 MediaCaptureDevicesDispatcher::GetInstance()-> 294 MediaCaptureDevicesDispatcher::GetInstance()->
295 GetMediaStreamCaptureIndicator(); 295 GetMediaStreamCaptureIndicator();
296 const MediaStreamDevice dummyVideoCaptureDevice( 296 const MediaStreamDevice dummyVideoCaptureDevice(
297 content::MEDIA_TAB_VIDEO_CAPTURE, "dummy_id", "dummy name"); 297 content::MEDIA_TAB_VIDEO_CAPTURE, "dummy_id", "dummy name");
298 scoped_ptr<MediaStreamUI> streamUi(indicator->RegisterMediaStream( 298 std::unique_ptr<MediaStreamUI> streamUi(indicator->RegisterMediaStream(
299 contents, MediaStreamDevices(1, dummyVideoCaptureDevice))); 299 contents, MediaStreamDevices(1, dummyVideoCaptureDevice)));
300 streamUi->OnStarted(base::Bind(&base::DoNothing)); 300 streamUi->OnStarted(base::Bind(&base::DoNothing));
301 EXPECT_EQ(TabAlertState::TAB_CAPTURING, 301 EXPECT_EQ(TabAlertState::TAB_CAPTURING,
302 chrome::GetTabAlertStateForContents(contents)); 302 chrome::GetTabAlertStateForContents(contents));
303 [controller_ setTabTitle:tabController withContents:contents]; 303 [controller_ setTabTitle:tabController withContents:contents];
304 EXPECT_NSEQ(baseTitle, [tabController title]); 304 EXPECT_NSEQ(baseTitle, [tabController title]);
305 NSString* const toolTipText = [tabController toolTip]; 305 NSString* const toolTipText = [tabController toolTip];
306 if ([baseTitle length] > 0) { 306 if ([baseTitle length] > 0) {
307 EXPECT_TRUE(NSEqualRanges(NSMakeRange(0, [baseTitle length]), 307 EXPECT_TRUE(NSEqualRanges(NSMakeRange(0, [baseTitle length]),
308 [toolTipText rangeOfString:baseTitle])); 308 [toolTipText rangeOfString:baseTitle]));
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 [tabStripControllerForTesting setAlertStateForContents:contents_at_tab0 461 [tabStripControllerForTesting setAlertStateForContents:contents_at_tab0
462 withAlertState:TabAlertState::NONE]; 462 withAlertState:TabAlertState::NONE];
463 [controller_ updateWindowAlertState:TabAlertState::NONE 463 [controller_ updateWindowAlertState:TabAlertState::NONE
464 forWebContents:contents_at_tab0]; 464 forWebContents:contents_at_tab0];
465 // Neither of tabs playing nor muting, so the window alert state should be 465 // Neither of tabs playing nor muting, so the window alert state should be
466 // NONE. 466 // NONE.
467 EXPECT_EQ(TabAlertState::NONE, [window_controller alertState]); 467 EXPECT_EQ(TabAlertState::NONE, [window_controller alertState]);
468 } 468 }
469 469
470 } // namespace 470 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/tabs/tab_strip_controller.h ('k') | chrome/browser/ui/cocoa/toolbar/app_toolbar_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698