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

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

Issue 1144153004: components: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 6 months 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 "base/run_loop.h" 5 #include "base/run_loop.h"
6 #include "base/strings/string_util.h" 6 #include "base/strings/string_util.h"
7 #include "base/thread_task_runner_handle.h"
7 #include "components/invalidation/gcm_network_channel.h" 8 #include "components/invalidation/gcm_network_channel.h"
8 #include "google_apis/gaia/google_service_auth_error.h" 9 #include "google_apis/gaia/google_service_auth_error.h"
9 #include "net/url_request/test_url_fetcher_factory.h" 10 #include "net/url_request/test_url_fetcher_factory.h"
10 #include "net/url_request/url_request_test_util.h" 11 #include "net/url_request/url_request_test_util.h"
11 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
12 13
13 namespace syncer { 14 namespace syncer {
14 15
15 class TestGCMNetworkChannelDelegate : public GCMNetworkChannelDelegate { 16 class TestGCMNetworkChannelDelegate : public GCMNetworkChannelDelegate {
16 public: 17 public:
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 public: 123 public:
123 GCMNetworkChannelTest() 124 GCMNetworkChannelTest()
124 : delegate_(NULL), 125 : delegate_(NULL),
125 url_fetchers_created_count_(0), 126 url_fetchers_created_count_(0),
126 last_invalidator_state_(TRANSIENT_INVALIDATION_ERROR) {} 127 last_invalidator_state_(TRANSIENT_INVALIDATION_ERROR) {}
127 128
128 ~GCMNetworkChannelTest() override {} 129 ~GCMNetworkChannelTest() override {}
129 130
130 void SetUp() override { 131 void SetUp() override {
131 request_context_getter_ = new net::TestURLRequestContextGetter( 132 request_context_getter_ = new net::TestURLRequestContextGetter(
132 base::MessageLoopProxy::current()); 133 base::ThreadTaskRunnerHandle::Get());
133 // Ownership of delegate goes to GCNMentworkChannel but test needs pointer 134 // Ownership of delegate goes to GCNMentworkChannel but test needs pointer
134 // to it. 135 // to it.
135 delegate_ = new TestGCMNetworkChannelDelegate(); 136 delegate_ = new TestGCMNetworkChannelDelegate();
136 scoped_ptr<GCMNetworkChannelDelegate> delegate(delegate_); 137 scoped_ptr<GCMNetworkChannelDelegate> delegate(delegate_);
137 gcm_network_channel_.reset(new TestGCMNetworkChannel( 138 gcm_network_channel_.reset(new TestGCMNetworkChannel(
138 request_context_getter_, 139 request_context_getter_,
139 delegate.Pass())); 140 delegate.Pass()));
140 gcm_network_channel_->AddObserver(this); 141 gcm_network_channel_->AddObserver(this);
141 gcm_network_channel_->SetMessageReceiver( 142 gcm_network_channel_->SetMessageReceiver(
142 invalidation::NewPermanentCallback( 143 invalidation::NewPermanentCallback(
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 delegate()->request_token_callback.Run( 503 delegate()->request_token_callback.Run(
503 GoogleServiceAuthError::AuthErrorNone(), "access.token"); 504 GoogleServiceAuthError::AuthErrorNone(), "access.token");
504 RunLoopUntilIdle(); 505 RunLoopUntilIdle();
505 EXPECT_EQ(url_fetchers_created_count(), 3); 506 EXPECT_EQ(url_fetchers_created_count(), 3);
506 // Echo_token should be from second message. 507 // Echo_token should be from second message.
507 EXPECT_EQ("echo.token", get_last_echo_token()); 508 EXPECT_EQ("echo.token", get_last_echo_token());
508 } 509 }
509 #endif 510 #endif
510 511
511 } // namespace syncer 512 } // namespace syncer
OLDNEW
« no previous file with comments | « components/invalidation/gcm_network_channel.cc ('k') | components/invalidation/invalidation_notifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698