| Index: chrome/browser/ui/sync/one_click_signin_sync_observer_unittest.cc
|
| diff --git a/chrome/browser/ui/sync/one_click_signin_sync_observer_unittest.cc b/chrome/browser/ui/sync/one_click_signin_sync_observer_unittest.cc
|
| index def8f51420c6f7369e371ad53c094d193add570b..802ff7760431b80bcfbbd0103ea5a880e59c0f15 100644
|
| --- a/chrome/browser/ui/sync/one_click_signin_sync_observer_unittest.cc
|
| +++ b/chrome/browser/ui/sync/one_click_signin_sync_observer_unittest.cc
|
| @@ -25,6 +25,7 @@
|
| #include "content/public/browser/reload_type.h"
|
| #include "content/public/browser/render_frame_host.h"
|
| #include "content/public/browser/web_contents.h"
|
| +#include "content/public/common/browser_side_navigation_policy.h"
|
| #include "content/public/test/test_utils.h"
|
| #include "testing/gmock/include/gmock/gmock.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| @@ -45,7 +46,9 @@ class MockWebContentsObserver : public content::WebContentsObserver {
|
| // to the continue URL. Navigations in unit_tests never complete, but a
|
| // navigation start is a sufficient signal for the purposes of this test.
|
| // Listening for this call also has the advantage of being synchronous.
|
| - MOCK_METHOD2(DidStartNavigationToPendingEntry,
|
| + MOCK_METHOD1(DidStartNavigation, void(content::NavigationHandle*));
|
| + // TODO: remove this method when PlzNavigate is turned on by default.
|
| + MOCK_METHOD2(DidStartNavigationToPendingEntry,
|
| void(const GURL&, content::ReloadType));
|
| };
|
|
|
| @@ -177,7 +180,12 @@ TEST_F(OneClickSigninSyncObserverTest, NoSyncService_RedirectsImmediately) {
|
| profile(), BuildNullService));
|
|
|
| // The observer should immediately redirect to the continue URL.
|
| - EXPECT_CALL(*web_contents_observer_, DidStartNavigationToPendingEntry(_, _));
|
| + if (content::IsBrowserSideNavigationEnabled()) {
|
| + EXPECT_CALL(*web_contents_observer_, DidStartNavigation(_));
|
| + } else {
|
| + EXPECT_CALL(*web_contents_observer_,
|
| + DidStartNavigationToPendingEntry(_, _));
|
| + }
|
| CreateSyncObserver(kContinueUrl);
|
| EXPECT_EQ(GURL(kContinueUrl), web_contents()->GetVisibleURL());
|
|
|
| @@ -189,10 +197,16 @@ TEST_F(OneClickSigninSyncObserverTest, NoSyncService_RedirectsImmediately) {
|
| // Verify that when the WebContents is destroyed without any Sync notifications
|
| // firing, the observer cleans up its memory without loading the continue URL.
|
| TEST_F(OneClickSigninSyncObserverTest, WebContentsDestroyed) {
|
| - EXPECT_CALL(*web_contents_observer_,
|
| - DidStartNavigationToPendingEntry(_, _)).Times(0);
|
| - CreateSyncObserver(kContinueUrl);
|
| - SetContents(NULL);
|
| + if (content::IsBrowserSideNavigationEnabled()) {
|
| + EXPECT_CALL(*web_contents_observer_, DidStartNavigation(_)).Times(0);;
|
| + CreateSyncObserver(kContinueUrl);
|
| + SetContents(NULL);
|
| + } else {
|
| + EXPECT_CALL(*web_contents_observer_,
|
| + DidStartNavigationToPendingEntry(_, _)).Times(0);
|
| + CreateSyncObserver(kContinueUrl);
|
| + SetContents(NULL);
|
| + }
|
| }
|
|
|
| // Verify that when Sync is configured successfully, the observer loads the
|
| @@ -203,7 +217,12 @@ TEST_F(OneClickSigninSyncObserverTest,
|
| sync_service_->set_first_setup_in_progress(false);
|
| sync_service_->set_sync_active(true);
|
|
|
| - EXPECT_CALL(*web_contents_observer_, DidStartNavigationToPendingEntry(_, _));
|
| + if (content::IsBrowserSideNavigationEnabled()) {
|
| + EXPECT_CALL(*web_contents_observer_, DidStartNavigation(_));
|
| + } else {
|
| + EXPECT_CALL(*web_contents_observer_,
|
| + DidStartNavigationToPendingEntry(_, _));
|
| + }
|
| sync_service_->NotifyObservers();
|
| EXPECT_EQ(GURL(kContinueUrl), web_contents()->GetVisibleURL());
|
| }
|
| @@ -216,9 +235,14 @@ TEST_F(OneClickSigninSyncObserverTest,
|
| sync_service_->set_first_setup_in_progress(false);
|
| sync_service_->set_sync_active(false);
|
|
|
| - EXPECT_CALL(*web_contents_observer_,
|
| - DidStartNavigationToPendingEntry(_, _)).Times(0);
|
| - sync_service_->NotifyObservers();
|
| + if (content::IsBrowserSideNavigationEnabled()) {
|
| + EXPECT_CALL(*web_contents_observer_, DidStartNavigation(_)).Times(0);
|
| + sync_service_->NotifyObservers();
|
| + } else {
|
| + EXPECT_CALL(*web_contents_observer_,
|
| + DidStartNavigationToPendingEntry(_, _)).Times(0);
|
| + sync_service_->NotifyObservers();
|
| + }
|
| EXPECT_NE(GURL(kContinueUrl), web_contents()->GetVisibleURL());
|
| }
|
|
|
| @@ -230,9 +254,14 @@ TEST_F(OneClickSigninSyncObserverTest,
|
| sync_service_->set_first_setup_in_progress(true);
|
| sync_service_->set_sync_active(false);
|
|
|
| - EXPECT_CALL(*web_contents_observer_,
|
| - DidStartNavigationToPendingEntry(_, _)).Times(0);
|
| - sync_service_->NotifyObservers();
|
| + if (content::IsBrowserSideNavigationEnabled()) {
|
| + EXPECT_CALL(*web_contents_observer_, DidStartNavigation(_)).Times(0);;
|
| + sync_service_->NotifyObservers();
|
| + } else {
|
| + EXPECT_CALL(*web_contents_observer_,
|
| + DidStartNavigationToPendingEntry(_, _)).Times(0);;
|
| + sync_service_->NotifyObservers();
|
| + }
|
| EXPECT_NE(GURL(kContinueUrl), web_contents()->GetVisibleURL());
|
|
|
| // Trigger an event to force state to be cleaned up.
|
| @@ -250,8 +279,13 @@ TEST_F(OneClickSigninSyncObserverTest,
|
| sync_service_->set_first_setup_in_progress(false);
|
| sync_service_->set_sync_active(true);
|
|
|
| - EXPECT_CALL(*web_contents_observer_,
|
| - DidStartNavigationToPendingEntry(_, _)).Times(0);
|
| - sync_service_->NotifyObservers();
|
| + if (content::IsBrowserSideNavigationEnabled()) {
|
| + EXPECT_CALL(*web_contents_observer_, DidStartNavigation(_)).Times(0);
|
| + sync_service_->NotifyObservers();
|
| + } else {
|
| + EXPECT_CALL(*web_contents_observer_,
|
| + DidStartNavigationToPendingEntry(_, _)).Times(0);
|
| + sync_service_->NotifyObservers();
|
| + }
|
| EXPECT_NE(GURL(kContinueUrl), web_contents()->GetVisibleURL());
|
| }
|
|
|