| 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 "chrome/browser/ui/sync/one_click_signin_sync_observer.h" | 5 #include "chrome/browser/ui/sync/one_click_signin_sync_observer.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 public: | 38 public: |
| 39 explicit MockWebContentsObserver(content::WebContents* web_contents) | 39 explicit MockWebContentsObserver(content::WebContents* web_contents) |
| 40 : content::WebContentsObserver(web_contents) {} | 40 : content::WebContentsObserver(web_contents) {} |
| 41 virtual ~MockWebContentsObserver() {} | 41 virtual ~MockWebContentsObserver() {} |
| 42 | 42 |
| 43 // A hook to verify that the OneClickSigninSyncObserver initiated a redirect | 43 // A hook to verify that the OneClickSigninSyncObserver initiated a redirect |
| 44 // to the continue URL. Navigations in unit_tests never complete, but a | 44 // to the continue URL. Navigations in unit_tests never complete, but a |
| 45 // navigation start is a sufficient signal for the purposes of this test. | 45 // navigation start is a sufficient signal for the purposes of this test. |
| 46 // Listening for this call also has the advantage of being synchronous. | 46 // Listening for this call also has the advantage of being synchronous. |
| 47 MOCK_METHOD2(DidStartNavigationToPendingEntry, | 47 MOCK_METHOD2(DidStartNavigationToPendingEntry, |
| 48 void(const GURL&, content::NavigationController::ReloadType)); | 48 void(const GURL&, content::ReloadType)); |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 class OneClickTestProfileSyncService : public TestProfileSyncService { | 51 class OneClickTestProfileSyncService : public TestProfileSyncService { |
| 52 public: | 52 public: |
| 53 ~OneClickTestProfileSyncService() override {} | 53 ~OneClickTestProfileSyncService() override {} |
| 54 | 54 |
| 55 // Helper routine to be used in conjunction with | 55 // Helper routine to be used in conjunction with |
| 56 // BrowserContextKeyedServiceFactory::SetTestingFactory(). | 56 // BrowserContextKeyedServiceFactory::SetTestingFactory(). |
| 57 static std::unique_ptr<KeyedService> Build(content::BrowserContext* profile) { | 57 static std::unique_ptr<KeyedService> Build(content::BrowserContext* profile) { |
| 58 return base::WrapUnique(new OneClickTestProfileSyncService( | 58 return base::WrapUnique(new OneClickTestProfileSyncService( |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 signin_metrics::Reason::REASON_SIGNIN_PRIMARY_ACCOUNT, false); | 249 signin_metrics::Reason::REASON_SIGNIN_PRIMARY_ACCOUNT, false); |
| 250 CreateSyncObserver(continue_url.spec()); | 250 CreateSyncObserver(continue_url.spec()); |
| 251 sync_service_->set_first_setup_in_progress(false); | 251 sync_service_->set_first_setup_in_progress(false); |
| 252 sync_service_->set_sync_active(true); | 252 sync_service_->set_sync_active(true); |
| 253 | 253 |
| 254 EXPECT_CALL(*web_contents_observer_, | 254 EXPECT_CALL(*web_contents_observer_, |
| 255 DidStartNavigationToPendingEntry(_, _)).Times(0); | 255 DidStartNavigationToPendingEntry(_, _)).Times(0); |
| 256 sync_service_->NotifyObservers(); | 256 sync_service_->NotifyObservers(); |
| 257 EXPECT_NE(GURL(kContinueUrl), web_contents()->GetVisibleURL()); | 257 EXPECT_NE(GURL(kContinueUrl), web_contents()->GetVisibleURL()); |
| 258 } | 258 } |
| OLD | NEW |