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

Side by Side Diff: chrome/browser/ui/cocoa/browser_window_controller_browsertest.mm

Issue 14689007: Instant Extended: Move omnibox dropdown by 2 pixels (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/browser_window_controller_private.mm » ('j') | 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 "chrome/browser/ui/cocoa/browser_window_controller.h" 5 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
6 6
7 #import "base/mac/mac_util.h" 7 #import "base/mac/mac_util.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 view_list.push_back(VIEW_ID_DOWNLOAD_SHELF); 382 view_list.push_back(VIEW_ID_DOWNLOAD_SHELF);
383 VerifyZOrder(view_list); 383 VerifyZOrder(view_list);
384 } 384 }
385 385
386 // Verify that in non-Instant presentation mode the content area is beneath 386 // Verify that in non-Instant presentation mode the content area is beneath
387 // the bookmark bar and info bar. 387 // the bookmark bar and info bar.
388 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, ContentOffset) { 388 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, ContentOffset) {
389 OverlayableContentsController* overlay = 389 OverlayableContentsController* overlay =
390 [controller() overlayableContentsController]; 390 [controller() overlayableContentsController];
391 // Just toolbar. 391 // Just toolbar.
392 EXPECT_EQ(bookmarks::kBookmarkBarOverlap, 392 EXPECT_EQ(1, [overlay activeContainerOffset]);
393 [overlay activeContainerOffset]);
394 393
395 // Plus bookmark bar. 394 // Plus bookmark bar.
396 browser()->window()->ToggleBookmarkBar(); 395 browser()->window()->ToggleBookmarkBar();
397 EXPECT_EQ(GetViewHeight(VIEW_ID_BOOKMARK_BAR), 396 CGFloat bookmark_bar_offset =
398 [overlay activeContainerOffset]); 397 GetViewHeight(VIEW_ID_BOOKMARK_BAR) - bookmarks::kBookmarkBarOverlap + 1;
398 EXPECT_EQ(bookmark_bar_offset, [overlay activeContainerOffset]);
399 399
400 // Plus info bar. 400 // Plus info bar.
401 ShowInfoBar(); 401 ShowInfoBar();
402 EXPECT_EQ(GetViewHeight(VIEW_ID_BOOKMARK_BAR) + 402 EXPECT_EQ(bookmark_bar_offset + GetViewHeight(VIEW_ID_INFO_BAR),
403 GetViewHeight(VIEW_ID_INFO_BAR),
404 [overlay activeContainerOffset]); 403 [overlay activeContainerOffset]);
405 404
406 // Minus bookmark bar. 405 // Minus bookmark bar.
407 browser()->window()->ToggleBookmarkBar(); 406 browser()->window()->ToggleBookmarkBar();
408 EXPECT_EQ(GetViewHeight(VIEW_ID_INFO_BAR) + bookmarks::kBookmarkBarOverlap, 407 EXPECT_EQ(GetViewHeight(VIEW_ID_INFO_BAR) + 1,
409 [overlay activeContainerOffset]); 408 [overlay activeContainerOffset]);
410 } 409 }
411 410
412 // Verify that in non-Instant presentation mode the content area is beneath 411 // Verify that in non-Instant presentation mode the content area is beneath
413 // the info bar. 412 // the info bar.
414 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, 413 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest,
415 DISABLED_ContentOffsetPresentationMode) { 414 DISABLED_ContentOffsetPresentationMode) {
416 // TODO(kbr): re-enable: http://crbug.com/222296 415 // TODO(kbr): re-enable: http://crbug.com/222296
417 if (base::mac::IsOSMountainLionOrLater()) 416 if (base::mac::IsOSMountainLionOrLater())
418 return; 417 return;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 } 460 }
462 461
463 // The Instant NTP case is same as normal case except that the overlay is 462 // The Instant NTP case is same as normal case except that the overlay is
464 // also shifted down. 463 // also shifted down.
465 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, ContentOffsetInstantNTP) { 464 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, ContentOffsetInstantNTP) {
466 ShowInstantNTP(); 465 ShowInstantNTP();
467 OverlayableContentsController* overlay = 466 OverlayableContentsController* overlay =
468 [controller() overlayableContentsController]; 467 [controller() overlayableContentsController];
469 468
470 // Just toolbar. 469 // Just toolbar.
471 EXPECT_EQ(bookmarks::kBookmarkBarOverlap, 470 EXPECT_EQ(1, [overlay activeContainerOffset]);
472 [overlay activeContainerOffset]);
473 471
474 // Plus bookmark bar. 472 // Plus bookmark bar.
475 browser()->window()->ToggleBookmarkBar(); 473 browser()->window()->ToggleBookmarkBar();
476 EXPECT_EQ(GetViewHeight(VIEW_ID_BOOKMARK_BAR), 474 CGFloat bookmark_bar_offset =
477 [overlay activeContainerOffset]); 475 GetViewHeight(VIEW_ID_BOOKMARK_BAR) - bookmarks::kBookmarkBarOverlap + 1;
476 EXPECT_EQ(bookmark_bar_offset, [overlay activeContainerOffset]);
478 477
479 // Plus info bar. 478 // Plus info bar.
480 ShowInfoBar(); 479 ShowInfoBar();
481 EXPECT_EQ(GetViewHeight(VIEW_ID_BOOKMARK_BAR) + 480 EXPECT_EQ(bookmark_bar_offset + GetViewHeight(VIEW_ID_INFO_BAR),
482 GetViewHeight(VIEW_ID_INFO_BAR),
483 [overlay activeContainerOffset]); 481 [overlay activeContainerOffset]);
484 482
485 // Minus bookmark bar. 483 // Minus bookmark bar.
486 browser()->window()->ToggleBookmarkBar(); 484 browser()->window()->ToggleBookmarkBar();
487 EXPECT_EQ(GetViewHeight(VIEW_ID_INFO_BAR) + bookmarks::kBookmarkBarOverlap, 485 EXPECT_EQ(GetViewHeight(VIEW_ID_INFO_BAR) + 1,
488 [overlay activeContainerOffset]); 486 [overlay activeContainerOffset]);
489 } 487 }
490 488
491 // Verify that the find bar is positioned corerctly when a full page instant 489 // Verify that the find bar is positioned corerctly when a full page instant
492 // search result is displayed. 490 // search result is displayed.
493 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, FindBarOffsetInstant) { 491 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, FindBarOffsetInstant) {
494 // Add bookmark bar and find bar. 492 // Add bookmark bar and find bar.
495 browser()->window()->ToggleBookmarkBar(); 493 browser()->window()->ToggleBookmarkBar();
496 browser()->GetFindBarController(); 494 browser()->GetFindBarController();
497 495
496 CGFloat line_width = [GetViewWithID(VIEW_ID_FIND_BAR) cr_lineWidth];
498 NSRect bookmark_bar_frame = [GetViewWithID(VIEW_ID_BOOKMARK_BAR) frame]; 497 NSRect bookmark_bar_frame = [GetViewWithID(VIEW_ID_BOOKMARK_BAR) frame];
499 NSRect find_bar_frame = [GetViewWithID(VIEW_ID_FIND_BAR) frame]; 498 NSRect find_bar_frame = [GetViewWithID(VIEW_ID_FIND_BAR) frame];
500 EXPECT_EQ(NSMinY(bookmark_bar_frame), NSMaxY(find_bar_frame) - 1); 499 EXPECT_EQ(NSMinY(bookmark_bar_frame), NSMaxY(find_bar_frame) - line_width);
501 500
502 // Show instant and add a find bar to it. 501 // Show instant and add a find bar to it.
503 ShowInstantResults(); 502 ShowInstantResults();
504 browser()->GetFindBarController()->find_bar()->Show(false);; 503 browser()->GetFindBarController()->find_bar()->Show(false);;
505 504
506 NSRect toolbar_bar_frame = [GetViewWithID(VIEW_ID_TOOLBAR) frame]; 505 NSRect toolbar_bar_frame = [GetViewWithID(VIEW_ID_TOOLBAR) frame];
507 find_bar_frame = [GetViewWithID(VIEW_ID_FIND_BAR) frame]; 506 find_bar_frame = [GetViewWithID(VIEW_ID_FIND_BAR) frame];
508 EXPECT_EQ(NSMinY(toolbar_bar_frame) - 1, NSMaxY(find_bar_frame)); 507 EXPECT_EQ(NSMinY(toolbar_bar_frame) - bookmarks::kBookmarkBarOverlap + 1 -
508 line_width,
509 NSMaxY(find_bar_frame));
509 } 510 }
510 511
511 // Verify that if bookmark bar is underneath Instant search results then 512 // Verify that if bookmark bar is underneath Instant search results then
512 // clicking on Instant search results still works. 513 // clicking on Instant search results still works.
513 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, 514 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest,
514 InstantSearchResultsHitTest) { 515 InstantSearchResultsHitTest) {
515 browser()->window()->ToggleBookmarkBar(); 516 browser()->window()->ToggleBookmarkBar();
516 ShowInstantResults(); 517 ShowInstantResults();
517 518
518 NSView* bookmarkView = [[controller() bookmarkBarController] view]; 519 NSView* bookmarkView = [[controller() bookmarkBarController] view];
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 [[controller() infoBarContainerController] shouldSuppressTopInfoBarTip]); 607 [[controller() infoBarContainerController] shouldSuppressTopInfoBarTip]);
607 608
608 ShowInstantResults(); 609 ShowInstantResults();
609 EXPECT_TRUE( 610 EXPECT_TRUE(
610 [[controller() infoBarContainerController] shouldSuppressTopInfoBarTip]); 611 [[controller() infoBarContainerController] shouldSuppressTopInfoBarTip]);
611 612
612 HideInstant(); 613 HideInstant();
613 EXPECT_FALSE( 614 EXPECT_FALSE(
614 [[controller() infoBarContainerController] shouldSuppressTopInfoBarTip]); 615 [[controller() infoBarContainerController] shouldSuppressTopInfoBarTip]);
615 } 616 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/browser_window_controller_private.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698