OLD | NEW |
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 "google_apis/gcm/engine/gcm_store_impl.h" | 5 #include "google_apis/gcm/engine/gcm_store_impl.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/files/scoped_temp_dir.h" | 12 #include "base/files/scoped_temp_dir.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
15 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
16 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
17 #include "components/os_crypt/os_crypt.h" | |
18 #include "google_apis/gcm/base/mcs_message.h" | 17 #include "google_apis/gcm/base/mcs_message.h" |
19 #include "google_apis/gcm/base/mcs_util.h" | 18 #include "google_apis/gcm/base/mcs_util.h" |
20 #include "google_apis/gcm/protocol/mcs.pb.h" | 19 #include "google_apis/gcm/protocol/mcs.pb.h" |
21 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
22 | 21 |
23 namespace gcm { | 22 namespace gcm { |
24 | 23 |
25 namespace { | 24 namespace { |
26 | 25 |
27 // Number of persistent ids to use in tests. | 26 // Number of persistent ids to use in tests. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 GCMStoreImplTest::GCMStoreImplTest() | 64 GCMStoreImplTest::GCMStoreImplTest() |
66 : expected_success_(true), | 65 : expected_success_(true), |
67 next_persistent_id_(base::Time::Now().ToInternalValue()) { | 66 next_persistent_id_(base::Time::Now().ToInternalValue()) { |
68 EXPECT_TRUE(temp_directory_.CreateUniqueTempDir()); | 67 EXPECT_TRUE(temp_directory_.CreateUniqueTempDir()); |
69 run_loop_.reset(new base::RunLoop()); | 68 run_loop_.reset(new base::RunLoop()); |
70 } | 69 } |
71 | 70 |
72 GCMStoreImplTest::~GCMStoreImplTest() {} | 71 GCMStoreImplTest::~GCMStoreImplTest() {} |
73 | 72 |
74 scoped_ptr<GCMStore> GCMStoreImplTest::BuildGCMStore() { | 73 scoped_ptr<GCMStore> GCMStoreImplTest::BuildGCMStore() { |
75 #if defined(OS_MACOSX) | |
76 OSCrypt::UseMockKeychain(true); | |
77 #endif | |
78 return scoped_ptr<GCMStore>(new GCMStoreImpl( | 74 return scoped_ptr<GCMStore>(new GCMStoreImpl( |
| 75 true, |
79 temp_directory_.path(), | 76 temp_directory_.path(), |
80 message_loop_.message_loop_proxy())); | 77 message_loop_.message_loop_proxy())); |
81 } | 78 } |
82 | 79 |
83 std::string GCMStoreImplTest::GetNextPersistentId() { | 80 std::string GCMStoreImplTest::GetNextPersistentId() { |
84 return base::Uint64ToString(next_persistent_id_++); | 81 return base::Uint64ToString(next_persistent_id_++); |
85 } | 82 } |
86 | 83 |
87 void GCMStoreImplTest::PumpLoop() { message_loop_.RunUntilIdle(); } | 84 void GCMStoreImplTest::PumpLoop() { message_loop_.RunUntilIdle(); } |
88 | 85 |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 | 487 |
491 gcm_store->Load(base::Bind(&GCMStoreImplTest::LoadCallback, | 488 gcm_store->Load(base::Bind(&GCMStoreImplTest::LoadCallback, |
492 base::Unretained(this), | 489 base::Unretained(this), |
493 &load_result)); | 490 &load_result)); |
494 PumpLoop(); | 491 PumpLoop(); |
495 } | 492 } |
496 | 493 |
497 } // namespace | 494 } // namespace |
498 | 495 |
499 } // namespace gcm | 496 } // namespace gcm |
OLD | NEW |