| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "content/browser/web_contents/aura/overscroll_navigation_overlay.h" | 5 #include "content/browser/web_contents/aura/overscroll_navigation_overlay.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 EXPECT_EQ(GetOverlay()->direction_, OverscrollNavigationOverlay::NONE); | 391 EXPECT_EQ(GetOverlay()->direction_, OverscrollNavigationOverlay::NONE); |
| 392 histogram_tester()->ExpectTotalCount(kUmaCancelled, 1); | 392 histogram_tester()->ExpectTotalCount(kUmaCancelled, 1); |
| 393 histogram_tester()->ExpectBucketCount(kUmaCancelled, BACK_TOUCHPAD, 1); | 393 histogram_tester()->ExpectBucketCount(kUmaCancelled, BACK_TOUCHPAD, 1); |
| 394 EXPECT_EQ(1, action_tester()->GetActionCount(kActionCancelledBack)); | 394 EXPECT_EQ(1, action_tester()->GetActionCount(kActionCancelledBack)); |
| 395 // Navigation metrics shouldn't change. | 395 // Navigation metrics shouldn't change. |
| 396 histogram_tester()->ExpectTotalCount(kUmaNavigated, 1); | 396 histogram_tester()->ExpectTotalCount(kUmaNavigated, 1); |
| 397 EXPECT_EQ(1, action_tester()->GetActionCount(kActionNavigatedBack)); | 397 EXPECT_EQ(1, action_tester()->GetActionCount(kActionNavigatedBack)); |
| 398 | 398 |
| 399 EXPECT_TRUE(contents()->CrossProcessNavigationPending()); | 399 EXPECT_TRUE(contents()->CrossProcessNavigationPending()); |
| 400 NavigationEntry* pending = contents()->GetController().GetPendingEntry(); | 400 NavigationEntry* pending = contents()->GetController().GetPendingEntry(); |
| 401 contents()->GetPendingMainFrame()->SendNavigate( | 401 contents()->GetPendingMainFrame()->SendNavigateWithTransition( |
| 402 pending->GetUniqueID(), false, pending->GetURL()); | 402 pending->GetUniqueID(), false, pending->GetURL(), |
| 403 pending->GetTransitionType()); |
| 403 EXPECT_EQ(contents()->GetURL(), third()); | 404 EXPECT_EQ(contents()->GetURL(), third()); |
| 404 } | 405 } |
| 405 | 406 |
| 406 // Tests that an overscroll navigation that receives a paint update actually | 407 // Tests that an overscroll navigation that receives a paint update actually |
| 407 // stops observing. | 408 // stops observing. |
| 408 TEST_F(OverscrollNavigationOverlayTest, Navigation_PaintUpdate) { | 409 TEST_F(OverscrollNavigationOverlayTest, Navigation_PaintUpdate) { |
| 409 PerformBackNavigationViaSliderCallbacks(OverscrollSource::TOUCHSCREEN); | 410 PerformBackNavigationViaSliderCallbacks(OverscrollSource::TOUCHSCREEN); |
| 410 ReceivePaintUpdate(); | 411 ReceivePaintUpdate(); |
| 411 | 412 |
| 412 // Paint updates until the navigation is committed typically represent updates | 413 // Paint updates until the navigation is committed typically represent updates |
| 413 // for the previous page, so we should still be observing. | 414 // for the previous page, so we should still be observing. |
| 414 EXPECT_TRUE(GetOverlay()->web_contents()); | 415 EXPECT_TRUE(GetOverlay()->web_contents()); |
| 415 | 416 |
| 416 NavigationEntry* pending = contents()->GetController().GetPendingEntry(); | 417 NavigationEntry* pending = contents()->GetController().GetPendingEntry(); |
| 417 contents()->GetPendingMainFrame()->SendNavigate( | 418 contents()->GetPendingMainFrame()->SendNavigateWithTransition( |
| 418 pending->GetUniqueID(), false, pending->GetURL()); | 419 pending->GetUniqueID(), false, pending->GetURL(), |
| 420 pending->GetTransitionType()); |
| 419 ReceivePaintUpdate(); | 421 ReceivePaintUpdate(); |
| 420 | 422 |
| 421 // Navigation was committed and the paint update was received - we should no | 423 // Navigation was committed and the paint update was received - we should no |
| 422 // longer be observing. | 424 // longer be observing. |
| 423 EXPECT_FALSE(GetOverlay()->web_contents()); | 425 EXPECT_FALSE(GetOverlay()->web_contents()); |
| 424 EXPECT_EQ(contents()->GetURL(), third()); | 426 EXPECT_EQ(contents()->GetURL(), third()); |
| 425 } | 427 } |
| 426 | 428 |
| 427 // Tests that an overscroll navigation that receives a loading update actually | 429 // Tests that an overscroll navigation that receives a loading update actually |
| 428 // stops observing. | 430 // stops observing. |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 EXPECT_TRUE(GetOverlay()->window_.get()); | 550 EXPECT_TRUE(GetOverlay()->window_.get()); |
| 549 | 551 |
| 550 // Load the page. | 552 // Load the page. |
| 551 contents()->CommitPendingNavigation(); | 553 contents()->CommitPendingNavigation(); |
| 552 ReceivePaintUpdate(); | 554 ReceivePaintUpdate(); |
| 553 EXPECT_FALSE(GetOverlay()->window_.get()); | 555 EXPECT_FALSE(GetOverlay()->window_.get()); |
| 554 EXPECT_EQ(contents()->GetURL(), first()); | 556 EXPECT_EQ(contents()->GetURL(), first()); |
| 555 } | 557 } |
| 556 | 558 |
| 557 } // namespace content | 559 } // namespace content |
| OLD | NEW |