Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(929)

Side by Side Diff: components/invalidation/impl/gcm_network_channel_unittest.cc

Issue 2473813002: Notify GCMAppHandlers when the store is reset, so they clear cached IDs (Closed)
Patch Set: Update Cryptauth comment Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "components/invalidation/impl/gcm_network_channel.h" 5 #include "components/invalidation/impl/gcm_network_channel.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/base64url.h" 10 #include "base/base64url.h"
11 #include "base/run_loop.h" 11 #include "base/run_loop.h"
12 #include "base/strings/string_split.h" 12 #include "base/strings/string_split.h"
13 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
14 #include "base/threading/thread_task_runner_handle.h" 14 #include "base/threading/thread_task_runner_handle.h"
15 #include "build/build_config.h" 15 #include "build/build_config.h"
16 #include "google_apis/gaia/google_service_auth_error.h" 16 #include "google_apis/gaia/google_service_auth_error.h"
17 #include "net/url_request/test_url_fetcher_factory.h" 17 #include "net/url_request/test_url_fetcher_factory.h"
18 #include "net/url_request/url_request_test_util.h" 18 #include "net/url_request/url_request_test_util.h"
19 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
20 20
21 namespace syncer { 21 namespace syncer {
22 22
23 class TestGCMNetworkChannelDelegate : public GCMNetworkChannelDelegate { 23 class TestGCMNetworkChannelDelegate : public GCMNetworkChannelDelegate {
24 public: 24 public:
25 TestGCMNetworkChannelDelegate() 25 TestGCMNetworkChannelDelegate()
26 : register_call_count_(0) {} 26 : register_call_count_(0) {}
27 27
28 void Initialize( 28 void Initialize(ConnectionStateCallback connection_state_callback,
29 GCMNetworkChannelDelegate::ConnectionStateCallback callback) override { 29 base::Closure store_reset_callback) override {
30 connection_state_callback = callback; 30 this->connection_state_callback = connection_state_callback;
31 } 31 }
32 32
33 void RequestToken(RequestTokenCallback callback) override { 33 void RequestToken(RequestTokenCallback callback) override {
34 request_token_callback = callback; 34 request_token_callback = callback;
35 } 35 }
36 36
37 void InvalidateToken(const std::string& token) override { 37 void InvalidateToken(const std::string& token) override {
38 invalidated_token = token; 38 invalidated_token = token;
39 } 39 }
40 40
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 delegate()->request_token_callback.Run( 475 delegate()->request_token_callback.Run(
476 GoogleServiceAuthError::AuthErrorNone(), "access.token"); 476 GoogleServiceAuthError::AuthErrorNone(), "access.token");
477 RunLoopUntilIdle(); 477 RunLoopUntilIdle();
478 EXPECT_EQ(url_fetchers_created_count(), 3); 478 EXPECT_EQ(url_fetchers_created_count(), 3);
479 // Echo_token should be from second message. 479 // Echo_token should be from second message.
480 EXPECT_EQ("echo.token", get_last_echo_token()); 480 EXPECT_EQ("echo.token", get_last_echo_token());
481 } 481 }
482 #endif 482 #endif
483 483
484 } // namespace syncer 484 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698