| 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 "base/run_loop.h" | 5 #include "base/run_loop.h" |
| 6 #include "chrome/browser/signin/account_tracker_service_factory.h" | 6 #include "chrome/browser/signin/account_tracker_service_factory.h" |
| 7 #include "chrome/browser/signin/chrome_signin_client_factory.h" | 7 #include "chrome/browser/signin/chrome_signin_client_factory.h" |
| 8 #include "chrome/browser/signin/fake_account_tracker_service.h" | 8 #include "chrome/browser/signin/fake_account_tracker_service.h" |
| 9 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" | 9 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" |
| 10 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" | 10 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 &BuildAutoIssuingFakeProfileOAuth2TokenService); | 60 &BuildAutoIssuingFakeProfileOAuth2TokenService); |
| 61 builder.AddTestingFactory(AccountTrackerServiceFactory::GetInstance(), | 61 builder.AddTestingFactory(AccountTrackerServiceFactory::GetInstance(), |
| 62 FakeAccountTrackerService::Build); | 62 FakeAccountTrackerService::Build); |
| 63 builder.AddTestingFactory(ChromeSigninClientFactory::GetInstance(), | 63 builder.AddTestingFactory(ChromeSigninClientFactory::GetInstance(), |
| 64 signin::BuildTestSigninClient); | 64 signin::BuildTestSigninClient); |
| 65 profile_ = builder.Build(); | 65 profile_ = builder.Build(); |
| 66 | 66 |
| 67 FakeProfileOAuth2TokenService* token_service = | 67 FakeProfileOAuth2TokenService* token_service = |
| 68 (FakeProfileOAuth2TokenService*) | 68 (FakeProfileOAuth2TokenService*) |
| 69 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get()); | 69 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get()); |
| 70 token_service->IssueRefreshTokenForUser("", "fake_refresh_token"); | 70 token_service->UpdateCredentials("", "fake_refresh_token"); |
| 71 gcm_driver_.reset(new CustomFakeGCMDriver()); | 71 gcm_driver_.reset(new CustomFakeGCMDriver()); |
| 72 | 72 |
| 73 identity_provider_.reset(new FakeIdentityProvider(token_service)); | 73 identity_provider_.reset(new FakeIdentityProvider(token_service)); |
| 74 bridge_.reset(new GCMInvalidationBridge(gcm_driver_.get(), | 74 bridge_.reset(new GCMInvalidationBridge(gcm_driver_.get(), |
| 75 identity_provider_.get())); | 75 identity_provider_.get())); |
| 76 | 76 |
| 77 delegate_ = bridge_->CreateDelegate(); | 77 delegate_ = bridge_->CreateDelegate(); |
| 78 delegate_->Initialize( | 78 delegate_->Initialize( |
| 79 base::Bind(&GCMInvalidationBridgeTest::ConnectionStateChanged, | 79 base::Bind(&GCMInvalidationBridgeTest::ConnectionStateChanged, |
| 80 base::Unretained(this))); | 80 base::Unretained(this))); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 bridge_->OnConnected(net::IPEndPoint()); | 163 bridge_->OnConnected(net::IPEndPoint()); |
| 164 RunLoop(); | 164 RunLoop(); |
| 165 EXPECT_TRUE(connection_online_); | 165 EXPECT_TRUE(connection_online_); |
| 166 bridge_->OnDisconnected(); | 166 bridge_->OnDisconnected(); |
| 167 RunLoop(); | 167 RunLoop(); |
| 168 EXPECT_FALSE(connection_online_); | 168 EXPECT_FALSE(connection_online_); |
| 169 } | 169 } |
| 170 | 170 |
| 171 } // namespace | 171 } // namespace |
| 172 } // namespace invalidation | 172 } // namespace invalidation |
| OLD | NEW |