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

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

Issue 1946993004: [Mac][Material Design] Fix TabStripController test that fails under MD. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix variable name. Created 4 years, 7 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
« no previous file with comments | « chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 TabView* tab2 = CreateTab(); 243 TabView* tab2 = CreateTab();
244 244
245 EXPECT_FALSE([tab1 controller].selected); 245 EXPECT_FALSE([tab1 controller].selected);
246 EXPECT_TRUE([tab2 controller].selected); 246 EXPECT_TRUE([tab2 controller].selected);
247 247
248 // Check that there's no hovered tab yet. 248 // Check that there's no hovered tab yet.
249 EXPECT_FALSE([controller_ hoveredTab]); 249 EXPECT_FALSE([controller_ hoveredTab]);
250 250
251 // Set up mouse event on overlap of tab1 + tab2. 251 // Set up mouse event on overlap of tab1 + tab2.
252 const CGFloat min_y = NSMinY([tab_strip_.get() frame]) + 1; 252 const CGFloat min_y = NSMinY([tab_strip_.get() frame]) + 1;
253 const CGFloat tab_overlap = [TabStripController tabOverlap];
253 254
254 // Hover over overlap between tab 1 and 2. 255 // Hover over overlap between tab 1 and 2.
255 NSEvent* event = 256 NSRect tab1_frame = [tab1 frame];
256 cocoa_test_event_utils::MouseEventAtPoint(NSMakePoint(280, min_y), 257 NSPoint tab_overlap_point =
257 NSMouseMoved, 0); 258 NSMakePoint(NSMaxX(tab1_frame) - tab_overlap / 2, min_y);
259
260 NSEvent* event = cocoa_test_event_utils::MouseEventAtPoint(tab_overlap_point,
261 NSMouseMoved,
262 0);
258 [controller_.get() mouseMoved:event]; 263 [controller_.get() mouseMoved:event];
259 EXPECT_EQ(tab2, [controller_ hoveredTab]); 264 EXPECT_EQ(tab2, [controller_ hoveredTab]);
260 265
261 // Hover over tab 1. 266 // Hover over tab 1.
262 event = cocoa_test_event_utils::MouseEventAtPoint(NSMakePoint(260, min_y), 267 NSPoint hover_point = NSMakePoint(NSMidX(tab1_frame), min_y);
263 NSMouseMoved, 0); 268 event =
269 cocoa_test_event_utils::MouseEventAtPoint(hover_point, NSMouseMoved, 0);
264 [controller_.get() mouseMoved:event]; 270 [controller_.get() mouseMoved:event];
265 EXPECT_EQ(tab1, [controller_ hoveredTab]); 271 EXPECT_EQ(tab1, [controller_ hoveredTab]);
266 272
267 // Hover over tab 2. 273 // Hover over tab 2.
268 event = cocoa_test_event_utils::MouseEventAtPoint(NSMakePoint(290, min_y), 274 NSRect tab2_frame = [tab2 frame];
269 NSMouseMoved, 0); 275 hover_point = NSMakePoint(NSMidX(tab2_frame), min_y);
276 event =
277 cocoa_test_event_utils::MouseEventAtPoint(hover_point, NSMouseMoved, 0);
270 [controller_.get() mouseMoved:event]; 278 [controller_.get() mouseMoved:event];
271 EXPECT_EQ(tab2, [controller_ hoveredTab]); 279 EXPECT_EQ(tab2, [controller_ hoveredTab]);
272 } 280 }
273 281
274 TEST_F(TabStripControllerTest, CorrectTitleAndToolTipTextFromSetTabTitle) { 282 TEST_F(TabStripControllerTest, CorrectTitleAndToolTipTextFromSetTabTitle) {
275 using content::MediaStreamDevice; 283 using content::MediaStreamDevice;
276 using content::MediaStreamDevices; 284 using content::MediaStreamDevices;
277 using content::MediaStreamUI; 285 using content::MediaStreamUI;
278 286
279 TabView* const tab = CreateTab(); 287 TabView* const tab = CreateTab();
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 [tabStripControllerForTesting setAlertStateForContents:contents_at_tab0 484 [tabStripControllerForTesting setAlertStateForContents:contents_at_tab0
477 withAlertState:TabAlertState::NONE]; 485 withAlertState:TabAlertState::NONE];
478 [controller_ updateWindowAlertState:TabAlertState::NONE 486 [controller_ updateWindowAlertState:TabAlertState::NONE
479 forWebContents:contents_at_tab0]; 487 forWebContents:contents_at_tab0];
480 // Neither of tabs playing nor muting, so the window alert state should be 488 // Neither of tabs playing nor muting, so the window alert state should be
481 // NONE. 489 // NONE.
482 EXPECT_EQ(TabAlertState::NONE, [window_controller alertState]); 490 EXPECT_EQ(TabAlertState::NONE, [window_controller alertState]);
483 } 491 }
484 492
485 } // namespace 493 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698