| OLD | NEW |
| 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 // A standalone tool for testing MCS connections and the MCS client on their | 5 // A standalone tool for testing MCS connections and the MCS client on their |
| 6 // own. | 6 // own. |
| 7 | 7 |
| 8 #include <cstddef> | 8 #include <cstddef> |
| 9 #include <cstdio> | 9 #include <cstdio> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 gcm_store_.reset( | 300 gcm_store_.reset( |
| 301 new GCMStoreImpl(gcm_store_path_, | 301 new GCMStoreImpl(gcm_store_path_, |
| 302 file_thread_.message_loop_proxy(), | 302 file_thread_.message_loop_proxy(), |
| 303 make_scoped_ptr<Encryptor>(new FakeEncryptor))); | 303 make_scoped_ptr<Encryptor>(new FakeEncryptor))); |
| 304 mcs_client_.reset(new MCSClient("probe", | 304 mcs_client_.reset(new MCSClient("probe", |
| 305 &clock_, | 305 &clock_, |
| 306 connection_factory_.get(), | 306 connection_factory_.get(), |
| 307 gcm_store_.get(), | 307 gcm_store_.get(), |
| 308 &recorder_)); | 308 &recorder_)); |
| 309 run_loop_.reset(new base::RunLoop()); | 309 run_loop_.reset(new base::RunLoop()); |
| 310 gcm_store_->Load(base::Bind(&MCSProbe::LoadCallback, | 310 gcm_store_->Load(GCMStore::CREATE_NEW_STORE_IF_NOT_EXISTS, |
| 311 base::Bind(&MCSProbe::LoadCallback, |
| 311 base::Unretained(this))); | 312 base::Unretained(this))); |
| 312 run_loop_->Run(); | 313 run_loop_->Run(); |
| 313 } | 314 } |
| 314 | 315 |
| 315 void MCSProbe::LoadCallback(scoped_ptr<GCMStore::LoadResult> load_result) { | 316 void MCSProbe::LoadCallback(scoped_ptr<GCMStore::LoadResult> load_result) { |
| 316 DCHECK(load_result->success); | 317 DCHECK(load_result->success); |
| 317 if (android_id_ != 0 && secret_ != 0) { | 318 if (android_id_ != 0 && secret_ != 0) { |
| 318 DVLOG(1) << "Presetting MCS id " << android_id_; | 319 DVLOG(1) << "Presetting MCS id " << android_id_; |
| 319 load_result->device_android_id = android_id_; | 320 load_result->device_android_id = android_id_; |
| 320 load_result->device_security_token = secret_; | 321 load_result->device_security_token = secret_; |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 | 495 |
| 495 return 0; | 496 return 0; |
| 496 } | 497 } |
| 497 | 498 |
| 498 } // namespace | 499 } // namespace |
| 499 } // namespace gcm | 500 } // namespace gcm |
| 500 | 501 |
| 501 int main(int argc, char* argv[]) { | 502 int main(int argc, char* argv[]) { |
| 502 return gcm::MCSProbeMain(argc, argv); | 503 return gcm::MCSProbeMain(argc, argv); |
| 503 } | 504 } |
| OLD | NEW |