| 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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 view_list.push_back(VIEW_ID_DOWNLOAD_SHELF); | 367 view_list.push_back(VIEW_ID_DOWNLOAD_SHELF); |
| 368 VerifyZOrder(view_list); | 368 VerifyZOrder(view_list); |
| 369 } | 369 } |
| 370 | 370 |
| 371 // Verify that in non-Instant presentation mode the content area is beneath | 371 // Verify that in non-Instant presentation mode the content area is beneath |
| 372 // the bookmark bar and info bar. | 372 // the bookmark bar and info bar. |
| 373 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, ContentOffset) { | 373 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, ContentOffset) { |
| 374 OverlayableContentsController* overlay = | 374 OverlayableContentsController* overlay = |
| 375 [controller() overlayableContentsController]; | 375 [controller() overlayableContentsController]; |
| 376 // Just toolbar. | 376 // Just toolbar. |
| 377 EXPECT_EQ(bookmarks::kBookmarkBarOverlap - 1, | 377 EXPECT_EQ(1, [overlay activeContainerOffset]); |
| 378 [overlay activeContainerOffset]); | |
| 379 | 378 |
| 380 // Plus bookmark bar. | 379 // Plus bookmark bar. |
| 381 browser()->window()->ToggleBookmarkBar(); | 380 browser()->window()->ToggleBookmarkBar(); |
| 382 EXPECT_EQ(GetViewHeight(VIEW_ID_BOOKMARK_BAR), | 381 CGFloat bookmarkBarOffset = |
| 383 [overlay activeContainerOffset]); | 382 GetViewHeight(VIEW_ID_BOOKMARK_BAR) - bookmarks::kBookmarkBarOverlap + 1; |
| 383 EXPECT_EQ(bookmarkBarOffset, [overlay activeContainerOffset]); |
| 384 | 384 |
| 385 // Plus info bar. | 385 // Plus info bar. |
| 386 ShowInfoBar(); | 386 ShowInfoBar(); |
| 387 EXPECT_EQ(GetViewHeight(VIEW_ID_BOOKMARK_BAR) + | 387 EXPECT_EQ(bookmarkBarOffset + GetViewHeight(VIEW_ID_INFO_BAR), |
| 388 GetViewHeight(VIEW_ID_INFO_BAR), | |
| 389 [overlay activeContainerOffset]); | 388 [overlay activeContainerOffset]); |
| 390 | 389 |
| 391 // Minus bookmark bar. | 390 // Minus bookmark bar. |
| 392 browser()->window()->ToggleBookmarkBar(); | 391 browser()->window()->ToggleBookmarkBar(); |
| 393 EXPECT_EQ(GetViewHeight(VIEW_ID_INFO_BAR) + bookmarks::kBookmarkBarOverlap, | 392 EXPECT_EQ(GetViewHeight(VIEW_ID_INFO_BAR) + 1, |
| 394 [overlay activeContainerOffset]); | 393 [overlay activeContainerOffset]); |
| 395 } | 394 } |
| 396 | 395 |
| 397 // Verify that in non-Instant presentation mode the content area is beneath | 396 // Verify that in non-Instant presentation mode the content area is beneath |
| 398 // the info bar. | 397 // the info bar. |
| 399 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, | 398 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, |
| 400 DISABLED_ContentOffsetPresentationMode) { | 399 DISABLED_ContentOffsetPresentationMode) { |
| 401 // TODO(kbr): re-enable: http://crbug.com/222296 | 400 // TODO(kbr): re-enable: http://crbug.com/222296 |
| 402 if (base::mac::IsOSMountainLionOrLater()) | 401 if (base::mac::IsOSMountainLionOrLater()) |
| 403 return; | 402 return; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 } | 445 } |
| 447 | 446 |
| 448 // The Instant NTP case is same as normal case except that the overlay is | 447 // The Instant NTP case is same as normal case except that the overlay is |
| 449 // also shifted down. | 448 // also shifted down. |
| 450 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, ContentOffsetInstantNTP) { | 449 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, ContentOffsetInstantNTP) { |
| 451 ShowInstantNTP(); | 450 ShowInstantNTP(); |
| 452 OverlayableContentsController* overlay = | 451 OverlayableContentsController* overlay = |
| 453 [controller() overlayableContentsController]; | 452 [controller() overlayableContentsController]; |
| 454 | 453 |
| 455 // Just toolbar. | 454 // Just toolbar. |
| 456 EXPECT_EQ(bookmarks::kBookmarkBarOverlap - 1, | 455 EXPECT_EQ(1, |
| 457 [overlay activeContainerOffset]); | 456 [overlay activeContainerOffset]); |
| 458 | 457 |
| 459 // Plus bookmark bar. | 458 // Plus bookmark bar. |
| 460 browser()->window()->ToggleBookmarkBar(); | 459 browser()->window()->ToggleBookmarkBar(); |
| 461 EXPECT_EQ(GetViewHeight(VIEW_ID_BOOKMARK_BAR), | 460 CGFloat bookmarkBarOffset = |
| 462 [overlay activeContainerOffset]); | 461 GetViewHeight(VIEW_ID_BOOKMARK_BAR) - bookmarks::kBookmarkBarOverlap + 1; |
| 462 EXPECT_EQ(bookmarkBarOffset, [overlay activeContainerOffset]); |
| 463 | 463 |
| 464 // Plus info bar. | 464 // Plus info bar. |
| 465 ShowInfoBar(); | 465 ShowInfoBar(); |
| 466 EXPECT_EQ(GetViewHeight(VIEW_ID_BOOKMARK_BAR) + | 466 EXPECT_EQ(bookmarkBarOffset + GetViewHeight(VIEW_ID_INFO_BAR), |
| 467 GetViewHeight(VIEW_ID_INFO_BAR), | |
| 468 [overlay activeContainerOffset]); | 467 [overlay activeContainerOffset]); |
| 469 | 468 |
| 470 // Minus bookmark bar. | 469 // Minus bookmark bar. |
| 471 browser()->window()->ToggleBookmarkBar(); | 470 browser()->window()->ToggleBookmarkBar(); |
| 472 EXPECT_EQ(GetViewHeight(VIEW_ID_INFO_BAR) + bookmarks::kBookmarkBarOverlap, | 471 EXPECT_EQ(GetViewHeight(VIEW_ID_INFO_BAR) + 1, |
| 473 [overlay activeContainerOffset]); | 472 [overlay activeContainerOffset]); |
| 474 } | 473 } |
| 475 | 474 |
| 476 // Verify that if bookmark bar is underneath Instant search results then | 475 // Verify that if bookmark bar is underneath Instant search results then |
| 477 // clicking on Instant search results still works. | 476 // clicking on Instant search results still works. |
| 478 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, | 477 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, |
| 479 InstantSearchResultsHitTest) { | 478 InstantSearchResultsHitTest) { |
| 480 browser()->window()->ToggleBookmarkBar(); | 479 browser()->window()->ToggleBookmarkBar(); |
| 481 ShowInstantResults(); | 480 ShowInstantResults(); |
| 482 | 481 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 494 // results mode. | 493 // results mode. |
| 495 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, InstantSearchResultsMode) { | 494 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, InstantSearchResultsMode) { |
| 496 chrome::EnableInstantExtendedAPIForTesting(); | 495 chrome::EnableInstantExtendedAPIForTesting(); |
| 497 SearchMode mode(SearchMode::MODE_SEARCH_RESULTS, SearchMode::ORIGIN_SEARCH); | 496 SearchMode mode(SearchMode::MODE_SEARCH_RESULTS, SearchMode::ORIGIN_SEARCH); |
| 498 browser()->search_model()->SetMode(mode); | 497 browser()->search_model()->SetMode(mode); |
| 499 browser()->search_model()->SetTopBarsVisible(false); | 498 browser()->search_model()->SetTopBarsVisible(false); |
| 500 EXPECT_TRUE(browser()->search_model()->mode().is_search_results()); | 499 EXPECT_TRUE(browser()->search_model()->mode().is_search_results()); |
| 501 EXPECT_EQ(browser_window_controller::kInstantUIFullPageResults, | 500 EXPECT_EQ(browser_window_controller::kInstantUIFullPageResults, |
| 502 [controller() currentInstantUIState]); | 501 [controller() currentInstantUIState]); |
| 503 } | 502 } |
| OLD | NEW |