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

Side by Side Diff: google_apis/gcm/engine/mcs_client_unittest.cc

Issue 261853012: Componentize GCM Part 1: create GCM component and move some files over (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « google_apis/gcm/engine/gcm_store_impl_unittest.cc ('k') | google_apis/gcm/gcm.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "google_apis/gcm/engine/mcs_client.h" 5 #include "google_apis/gcm/engine/mcs_client.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
11 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
12 #include "base/test/simple_test_clock.h" 12 #include "base/test/simple_test_clock.h"
13 #include "components/os_crypt/os_crypt_switches.h" 13 #include "google_apis/gcm/base/fake_encryptor.h"
14 #include "google_apis/gcm/base/mcs_util.h" 14 #include "google_apis/gcm/base/mcs_util.h"
15 #include "google_apis/gcm/engine/fake_connection_factory.h" 15 #include "google_apis/gcm/engine/fake_connection_factory.h"
16 #include "google_apis/gcm/engine/fake_connection_handler.h" 16 #include "google_apis/gcm/engine/fake_connection_handler.h"
17 #include "google_apis/gcm/engine/gcm_store_impl.h" 17 #include "google_apis/gcm/engine/gcm_store_impl.h"
18 #include "google_apis/gcm/monitoring/gcm_stats_recorder.h" 18 #include "google_apis/gcm/monitoring/gcm_stats_recorder.h"
19 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
20 20
21 namespace gcm { 21 namespace gcm {
22 22
23 namespace { 23 namespace {
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 run_loop_.reset(new base::RunLoop()); 152 run_loop_.reset(new base::RunLoop());
153 153
154 // Advance the clock to a non-zero time. 154 // Advance the clock to a non-zero time.
155 clock_.Advance(base::TimeDelta::FromSeconds(1)); 155 clock_.Advance(base::TimeDelta::FromSeconds(1));
156 } 156 }
157 157
158 MCSClientTest::~MCSClientTest() {} 158 MCSClientTest::~MCSClientTest() {}
159 159
160 void MCSClientTest::SetUp() { 160 void MCSClientTest::SetUp() {
161 testing::Test::SetUp(); 161 testing::Test::SetUp();
162 #if defined(OS_MACOSX)
163 base::CommandLine::ForCurrentProcess()->AppendSwitch(
164 os_crypt::switches::kUseMockKeychain);
165 #endif // OS_MACOSX
166 } 162 }
167 163
168 void MCSClientTest::BuildMCSClient() { 164 void MCSClientTest::BuildMCSClient() {
169 gcm_store_.reset(new GCMStoreImpl(temp_directory_.path(), 165 gcm_store_.reset(new GCMStoreImpl(
170 message_loop_.message_loop_proxy())); 166 temp_directory_.path(),
167 message_loop_.message_loop_proxy(),
168 make_scoped_ptr<Encryptor>(new FakeEncryptor)));
171 mcs_client_.reset(new TestMCSClient(&clock_, 169 mcs_client_.reset(new TestMCSClient(&clock_,
172 &connection_factory_, 170 &connection_factory_,
173 gcm_store_.get(), 171 gcm_store_.get(),
174 &recorder_)); 172 &recorder_));
175 } 173 }
176 174
177 void MCSClientTest::InitializeClient() { 175 void MCSClientTest::InitializeClient() {
178 gcm_store_->Load(base::Bind( 176 gcm_store_->Load(base::Bind(
179 &MCSClient::Initialize, 177 &MCSClient::Initialize,
180 base::Unretained(mcs_client_.get()), 178 base::Unretained(mcs_client_.get()),
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 790
793 LoginClient(std::vector<std::string>()); 791 LoginClient(std::vector<std::string>());
794 GetFakeHandler()->ExpectOutgoingMessage(message); 792 GetFakeHandler()->ExpectOutgoingMessage(message);
795 GetFakeHandler()->ExpectOutgoingMessage(message2); 793 GetFakeHandler()->ExpectOutgoingMessage(message2);
796 PumpLoop(); 794 PumpLoop();
797 } 795 }
798 796
799 } // namespace 797 } // namespace
800 798
801 } // namespace gcm 799 } // namespace gcm
OLDNEW
« no previous file with comments | « google_apis/gcm/engine/gcm_store_impl_unittest.cc ('k') | google_apis/gcm/gcm.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698