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/fake_profile_oauth2_token_service.h" | 6 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" |
7 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" | 7 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" |
8 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 8 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
9 #include "chrome/test/base/testing_profile.h" | 9 #include "chrome/test/base/testing_profile.h" |
10 #include "components/gcm_driver/fake_gcm_driver.h" | 10 #include "components/gcm_driver/fake_gcm_driver.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 private: | 42 private: |
43 DISALLOW_COPY_AND_ASSIGN(CustomFakeGCMDriver); | 43 DISALLOW_COPY_AND_ASSIGN(CustomFakeGCMDriver); |
44 }; | 44 }; |
45 | 45 |
46 class GCMInvalidationBridgeTest : public ::testing::Test { | 46 class GCMInvalidationBridgeTest : public ::testing::Test { |
47 protected: | 47 protected: |
48 GCMInvalidationBridgeTest() | 48 GCMInvalidationBridgeTest() |
49 : connection_online_(false) {} | 49 : connection_online_(false) {} |
50 | 50 |
51 virtual ~GCMInvalidationBridgeTest() {} | 51 ~GCMInvalidationBridgeTest() override {} |
52 | 52 |
53 virtual void SetUp() override { | 53 void SetUp() override { |
54 TestingProfile::Builder builder; | 54 TestingProfile::Builder builder; |
55 builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(), | 55 builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(), |
56 &BuildAutoIssuingFakeProfileOAuth2TokenService); | 56 &BuildAutoIssuingFakeProfileOAuth2TokenService); |
57 profile_ = builder.Build(); | 57 profile_ = builder.Build(); |
58 | 58 |
59 FakeProfileOAuth2TokenService* token_service = | 59 FakeProfileOAuth2TokenService* token_service = |
60 (FakeProfileOAuth2TokenService*) | 60 (FakeProfileOAuth2TokenService*) |
61 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get()); | 61 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get()); |
62 token_service->IssueRefreshTokenForUser("", "fake_refresh_token"); | 62 token_service->IssueRefreshTokenForUser("", "fake_refresh_token"); |
63 gcm_driver_.reset(new CustomFakeGCMDriver()); | 63 gcm_driver_.reset(new CustomFakeGCMDriver()); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 bridge_->OnConnected(net::IPEndPoint()); | 155 bridge_->OnConnected(net::IPEndPoint()); |
156 RunLoop(); | 156 RunLoop(); |
157 EXPECT_TRUE(connection_online_); | 157 EXPECT_TRUE(connection_online_); |
158 bridge_->OnDisconnected(); | 158 bridge_->OnDisconnected(); |
159 RunLoop(); | 159 RunLoop(); |
160 EXPECT_FALSE(connection_online_); | 160 EXPECT_FALSE(connection_online_); |
161 } | 161 } |
162 | 162 |
163 } // namespace | 163 } // namespace |
164 } // namespace invalidation | 164 } // namespace invalidation |
OLD | NEW |