Chromium Code Reviews| 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 "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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 380 view_list.push_back(VIEW_ID_DOWNLOAD_SHELF); | 380 view_list.push_back(VIEW_ID_DOWNLOAD_SHELF); |
| 381 VerifyZOrder(view_list); | 381 VerifyZOrder(view_list); |
| 382 } | 382 } |
| 383 | 383 |
| 384 // Verify that in non-Instant presentation mode the content area is beneath | 384 // Verify that in non-Instant presentation mode the content area is beneath |
| 385 // the bookmark bar and info bar. | 385 // the bookmark bar and info bar. |
| 386 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, ContentOffset) { | 386 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, ContentOffset) { |
| 387 OverlayableContentsController* overlay = | 387 OverlayableContentsController* overlay = |
| 388 [controller() overlayableContentsController]; | 388 [controller() overlayableContentsController]; |
| 389 // Just toolbar. | 389 // Just toolbar. |
| 390 EXPECT_EQ(bookmarks::kBookmarkBarOverlap, | 390 EXPECT_EQ(1, [overlay activeContainerOffset]); |
| 391 [overlay activeContainerOffset]); | |
| 392 | 391 |
| 393 // Plus bookmark bar. | 392 // Plus bookmark bar. |
| 394 browser()->window()->ToggleBookmarkBar(); | 393 browser()->window()->ToggleBookmarkBar(); |
| 395 EXPECT_EQ(GetViewHeight(VIEW_ID_BOOKMARK_BAR), | 394 CGFloat bookmarkBarOffset = |
|
Robert Sesek
2013/05/24 20:44:27
naming: bookmark_bar_offset
sail
2013/05/24 22:39:18
Done.
| |
| 396 [overlay activeContainerOffset]); | 395 GetViewHeight(VIEW_ID_BOOKMARK_BAR) - bookmarks::kBookmarkBarOverlap + 1; |
| 396 EXPECT_EQ(bookmarkBarOffset, [overlay activeContainerOffset]); | |
| 397 | 397 |
| 398 // Plus info bar. | 398 // Plus info bar. |
| 399 ShowInfoBar(); | 399 ShowInfoBar(); |
| 400 EXPECT_EQ(GetViewHeight(VIEW_ID_BOOKMARK_BAR) + | 400 EXPECT_EQ(bookmarkBarOffset + GetViewHeight(VIEW_ID_INFO_BAR), |
| 401 GetViewHeight(VIEW_ID_INFO_BAR), | |
| 402 [overlay activeContainerOffset]); | 401 [overlay activeContainerOffset]); |
| 403 | 402 |
| 404 // Minus bookmark bar. | 403 // Minus bookmark bar. |
| 405 browser()->window()->ToggleBookmarkBar(); | 404 browser()->window()->ToggleBookmarkBar(); |
| 406 EXPECT_EQ(GetViewHeight(VIEW_ID_INFO_BAR) + bookmarks::kBookmarkBarOverlap, | 405 EXPECT_EQ(GetViewHeight(VIEW_ID_INFO_BAR) + 1, |
| 407 [overlay activeContainerOffset]); | 406 [overlay activeContainerOffset]); |
| 408 } | 407 } |
| 409 | 408 |
| 410 // Verify that in non-Instant presentation mode the content area is beneath | 409 // Verify that in non-Instant presentation mode the content area is beneath |
| 411 // the info bar. | 410 // the info bar. |
| 412 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, | 411 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, |
| 413 DISABLED_ContentOffsetPresentationMode) { | 412 DISABLED_ContentOffsetPresentationMode) { |
| 414 // TODO(kbr): re-enable: http://crbug.com/222296 | 413 // TODO(kbr): re-enable: http://crbug.com/222296 |
| 415 if (base::mac::IsOSMountainLionOrLater()) | 414 if (base::mac::IsOSMountainLionOrLater()) |
| 416 return; | 415 return; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 459 } | 458 } |
| 460 | 459 |
| 461 // The Instant NTP case is same as normal case except that the overlay is | 460 // The Instant NTP case is same as normal case except that the overlay is |
| 462 // also shifted down. | 461 // also shifted down. |
| 463 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, ContentOffsetInstantNTP) { | 462 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, ContentOffsetInstantNTP) { |
| 464 ShowInstantNTP(); | 463 ShowInstantNTP(); |
| 465 OverlayableContentsController* overlay = | 464 OverlayableContentsController* overlay = |
| 466 [controller() overlayableContentsController]; | 465 [controller() overlayableContentsController]; |
| 467 | 466 |
| 468 // Just toolbar. | 467 // Just toolbar. |
| 469 EXPECT_EQ(bookmarks::kBookmarkBarOverlap, | 468 EXPECT_EQ(1, [overlay activeContainerOffset]); |
| 470 [overlay activeContainerOffset]); | |
| 471 | 469 |
| 472 // Plus bookmark bar. | 470 // Plus bookmark bar. |
| 473 browser()->window()->ToggleBookmarkBar(); | 471 browser()->window()->ToggleBookmarkBar(); |
| 474 EXPECT_EQ(GetViewHeight(VIEW_ID_BOOKMARK_BAR), | 472 CGFloat bookmarkBarOffset = |
|
Robert Sesek
2013/05/24 20:44:27
naming
sail
2013/05/24 22:39:18
Done.
| |
| 475 [overlay activeContainerOffset]); | 473 GetViewHeight(VIEW_ID_BOOKMARK_BAR) - bookmarks::kBookmarkBarOverlap + 1; |
| 474 EXPECT_EQ(bookmarkBarOffset, [overlay activeContainerOffset]); | |
| 476 | 475 |
| 477 // Plus info bar. | 476 // Plus info bar. |
| 478 ShowInfoBar(); | 477 ShowInfoBar(); |
| 479 EXPECT_EQ(GetViewHeight(VIEW_ID_BOOKMARK_BAR) + | 478 EXPECT_EQ(bookmarkBarOffset + GetViewHeight(VIEW_ID_INFO_BAR), |
| 480 GetViewHeight(VIEW_ID_INFO_BAR), | |
| 481 [overlay activeContainerOffset]); | 479 [overlay activeContainerOffset]); |
| 482 | 480 |
| 483 // Minus bookmark bar. | 481 // Minus bookmark bar. |
| 484 browser()->window()->ToggleBookmarkBar(); | 482 browser()->window()->ToggleBookmarkBar(); |
| 485 EXPECT_EQ(GetViewHeight(VIEW_ID_INFO_BAR) + bookmarks::kBookmarkBarOverlap, | 483 EXPECT_EQ(GetViewHeight(VIEW_ID_INFO_BAR) + 1, |
| 486 [overlay activeContainerOffset]); | 484 [overlay activeContainerOffset]); |
| 487 } | 485 } |
| 488 | 486 |
| 489 // Verify that if bookmark bar is underneath Instant search results then | 487 // Verify that if bookmark bar is underneath Instant search results then |
| 490 // clicking on Instant search results still works. | 488 // clicking on Instant search results still works. |
| 491 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, | 489 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, |
| 492 InstantSearchResultsHitTest) { | 490 InstantSearchResultsHitTest) { |
| 493 browser()->window()->ToggleBookmarkBar(); | 491 browser()->window()->ToggleBookmarkBar(); |
| 494 ShowInstantResults(); | 492 ShowInstantResults(); |
| 495 | 493 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 584 [[controller() infoBarContainerController] shouldSuppressTopInfoBarTip]); | 582 [[controller() infoBarContainerController] shouldSuppressTopInfoBarTip]); |
| 585 | 583 |
| 586 ShowInstantResults(); | 584 ShowInstantResults(); |
| 587 EXPECT_TRUE( | 585 EXPECT_TRUE( |
| 588 [[controller() infoBarContainerController] shouldSuppressTopInfoBarTip]); | 586 [[controller() infoBarContainerController] shouldSuppressTopInfoBarTip]); |
| 589 | 587 |
| 590 HideInstant(); | 588 HideInstant(); |
| 591 EXPECT_FALSE( | 589 EXPECT_FALSE( |
| 592 [[controller() infoBarContainerController] shouldSuppressTopInfoBarTip]); | 590 [[controller() infoBarContainerController] shouldSuppressTopInfoBarTip]); |
| 593 } | 591 } |
| OLD | NEW |