| 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 "google_apis/gaia/google_service_auth_error.h" | 6 #include "google_apis/gaia/google_service_auth_error.h" |
| 7 #include "net/url_request/test_url_fetcher_factory.h" | 7 #include "net/url_request/test_url_fetcher_factory.h" |
| 8 #include "net/url_request/url_request_test_util.h" | 8 #include "net/url_request/url_request_test_util.h" |
| 9 #include "sync/notifier/gcm_network_channel.h" | 9 #include "sync/notifier/gcm_network_channel.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 11 |
| 12 namespace syncer { | 12 namespace syncer { |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 class TestGCMNetworkChannelDelegate : public GCMNetworkChannelDelegate { | 15 class TestGCMNetworkChannelDelegate : public GCMNetworkChannelDelegate { |
| 16 public: | 16 public: |
| 17 TestGCMNetworkChannelDelegate() | 17 TestGCMNetworkChannelDelegate() |
| 18 : register_call_count_(0) {} | 18 : register_call_count_(0) {} |
| 19 | 19 |
| 20 virtual void Initialize() OVERRIDE {} |
| 21 |
| 20 virtual void RequestToken(RequestTokenCallback callback) OVERRIDE { | 22 virtual void RequestToken(RequestTokenCallback callback) OVERRIDE { |
| 21 request_token_callback = callback; | 23 request_token_callback = callback; |
| 22 } | 24 } |
| 23 | 25 |
| 24 virtual void InvalidateToken(const std::string& token) OVERRIDE { | 26 virtual void InvalidateToken(const std::string& token) OVERRIDE { |
| 25 invalidated_token = token; | 27 invalidated_token = token; |
| 26 } | 28 } |
| 27 | 29 |
| 28 virtual void Register(RegisterCallback callback) OVERRIDE { | 30 virtual void Register(RegisterCallback callback) OVERRIDE { |
| 29 ++register_call_count_; | 31 ++register_call_count_; |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 network_channel()->SendMessage("abra.cadabra"); | 288 network_channel()->SendMessage("abra.cadabra"); |
| 287 // Return valid registration id. | 289 // Return valid registration id. |
| 288 delegate()->register_callback.Run("registration.id", gcm::GCMClient::SUCCESS); | 290 delegate()->register_callback.Run("registration.id", gcm::GCMClient::SUCCESS); |
| 289 // RequestToken should be called by now. Let's not complete and see what | 291 // RequestToken should be called by now. Let's not complete and see what |
| 290 // happens. | 292 // happens. |
| 291 EXPECT_FALSE(delegate()->request_token_callback.is_null()); | 293 EXPECT_FALSE(delegate()->request_token_callback.is_null()); |
| 292 } | 294 } |
| 293 | 295 |
| 294 } // namespace | 296 } // namespace |
| 295 } // namespace syncer | 297 } // namespace syncer |
| OLD | NEW |