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

Side by Side Diff: chrome/browser/invalidation/gcm_invalidation_bridge_unittest.cc

Issue 1143343005: chrome/browser: 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/location.h"
5 #include "base/run_loop.h" 6 #include "base/run_loop.h"
7 #include "base/single_thread_task_runner.h"
8 #include "base/thread_task_runner_handle.h"
6 #include "chrome/browser/signin/account_tracker_service_factory.h" 9 #include "chrome/browser/signin/account_tracker_service_factory.h"
7 #include "chrome/browser/signin/chrome_signin_client_factory.h" 10 #include "chrome/browser/signin/chrome_signin_client_factory.h"
8 #include "chrome/browser/signin/fake_account_tracker_service.h" 11 #include "chrome/browser/signin/fake_account_tracker_service.h"
9 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" 12 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
10 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" 13 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h"
11 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 14 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
12 #include "chrome/browser/signin/test_signin_client_builder.h" 15 #include "chrome/browser/signin/test_signin_client_builder.h"
13 #include "chrome/test/base/testing_profile.h" 16 #include "chrome/test/base/testing_profile.h"
14 #include "components/gcm_driver/fake_gcm_driver.h" 17 #include "components/gcm_driver/fake_gcm_driver.h"
15 #include "components/gcm_driver/gcm_driver.h" 18 #include "components/gcm_driver/gcm_driver.h"
(...skipping 11 matching lines...) Expand all
27 // registrationId. 30 // registrationId.
28 class CustomFakeGCMDriver : public gcm::FakeGCMDriver { 31 class CustomFakeGCMDriver : public gcm::FakeGCMDriver {
29 public: 32 public:
30 CustomFakeGCMDriver() {} 33 CustomFakeGCMDriver() {}
31 ~CustomFakeGCMDriver() override {} 34 ~CustomFakeGCMDriver() override {}
32 35
33 protected: 36 protected:
34 // FakeGCMDriver override: 37 // FakeGCMDriver override:
35 void RegisterImpl(const std::string& app_id, 38 void RegisterImpl(const std::string& app_id,
36 const std::vector<std::string>& sender_ids) override { 39 const std::vector<std::string>& sender_ids) override {
37 base::MessageLoop::current()->PostTask( 40 base::ThreadTaskRunnerHandle::Get()->PostTask(
38 FROM_HERE, 41 FROM_HERE,
39 base::Bind(&CustomFakeGCMDriver::RegisterFinished, 42 base::Bind(&CustomFakeGCMDriver::RegisterFinished,
40 base::Unretained(this), 43 base::Unretained(this), app_id,
41 app_id, 44 std::string("registration.id"), gcm::GCMClient::SUCCESS));
42 std::string("registration.id"),
43 gcm::GCMClient::SUCCESS));
44 } 45 }
45 46
46 private: 47 private:
47 DISALLOW_COPY_AND_ASSIGN(CustomFakeGCMDriver); 48 DISALLOW_COPY_AND_ASSIGN(CustomFakeGCMDriver);
48 }; 49 };
49 50
50 class GCMInvalidationBridgeTest : public ::testing::Test { 51 class GCMInvalidationBridgeTest : public ::testing::Test {
51 protected: 52 protected:
52 GCMInvalidationBridgeTest() 53 GCMInvalidationBridgeTest()
53 : connection_online_(false) {} 54 : connection_online_(false) {}
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 bridge_->OnConnected(net::IPEndPoint()); 164 bridge_->OnConnected(net::IPEndPoint());
164 RunLoop(); 165 RunLoop();
165 EXPECT_TRUE(connection_online_); 166 EXPECT_TRUE(connection_online_);
166 bridge_->OnDisconnected(); 167 bridge_->OnDisconnected();
167 RunLoop(); 168 RunLoop();
168 EXPECT_FALSE(connection_online_); 169 EXPECT_FALSE(connection_online_);
169 } 170 }
170 171
171 } // namespace 172 } // namespace
172 } // namespace invalidation 173 } // namespace invalidation
OLDNEW
« no previous file with comments | « chrome/browser/intranet_redirect_detector.cc ('k') | chrome/browser/local_discovery/privet_http_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698