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

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

Issue 177243007: Fixing the GCMStoreImplTest.GetNextPersistentId on Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 void PumpLoop(); 50 void PumpLoop();
51 51
52 void LoadCallback(scoped_ptr<GCMStore::LoadResult>* result_dst, 52 void LoadCallback(scoped_ptr<GCMStore::LoadResult>* result_dst,
53 scoped_ptr<GCMStore::LoadResult> result); 53 scoped_ptr<GCMStore::LoadResult> result);
54 void UpdateCallback(bool success); 54 void UpdateCallback(bool success);
55 55
56 protected: 56 protected:
57 base::MessageLoop message_loop_; 57 base::MessageLoop message_loop_;
58 base::ScopedTempDir temp_directory_; 58 base::ScopedTempDir temp_directory_;
59 bool expected_success_; 59 bool expected_success_;
60 uint64 next_persistent_id_;
60 scoped_ptr<base::RunLoop> run_loop_; 61 scoped_ptr<base::RunLoop> run_loop_;
61 }; 62 };
62 63
63 GCMStoreImplTest::GCMStoreImplTest() 64 GCMStoreImplTest::GCMStoreImplTest()
64 : expected_success_(true) { 65 : expected_success_(true),
66 next_persistent_id_(base::Time::Now().ToInternalValue()) {
65 EXPECT_TRUE(temp_directory_.CreateUniqueTempDir()); 67 EXPECT_TRUE(temp_directory_.CreateUniqueTempDir());
66 run_loop_.reset(new base::RunLoop()); 68 run_loop_.reset(new base::RunLoop());
67 } 69 }
68 70
69 GCMStoreImplTest::~GCMStoreImplTest() {} 71 GCMStoreImplTest::~GCMStoreImplTest() {}
70 72
71 scoped_ptr<GCMStore> GCMStoreImplTest::BuildGCMStore() { 73 scoped_ptr<GCMStore> GCMStoreImplTest::BuildGCMStore() {
72 return scoped_ptr<GCMStore>(new GCMStoreImpl( 74 return scoped_ptr<GCMStore>(new GCMStoreImpl(
73 true, 75 true,
74 temp_directory_.path(), 76 temp_directory_.path(),
75 message_loop_.message_loop_proxy())); 77 message_loop_.message_loop_proxy()));
76 } 78 }
77 79
78 std::string GCMStoreImplTest::GetNextPersistentId() { 80 std::string GCMStoreImplTest::GetNextPersistentId() {
79 return base::Uint64ToString(base::Time::Now().ToInternalValue()); 81 return base::Uint64ToString(next_persistent_id_++);
80 } 82 }
81 83
82 void GCMStoreImplTest::PumpLoop() { message_loop_.RunUntilIdle(); } 84 void GCMStoreImplTest::PumpLoop() { message_loop_.RunUntilIdle(); }
83 85
84 void GCMStoreImplTest::LoadCallback( 86 void GCMStoreImplTest::LoadCallback(
85 scoped_ptr<GCMStore::LoadResult>* result_dst, 87 scoped_ptr<GCMStore::LoadResult>* result_dst,
86 scoped_ptr<GCMStore::LoadResult> result) { 88 scoped_ptr<GCMStore::LoadResult> result) {
87 ASSERT_TRUE(result->success); 89 ASSERT_TRUE(result->success);
88 *result_dst = result.Pass(); 90 *result_dst = result.Pass();
89 run_loop_->Quit(); 91 run_loop_->Quit();
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 MCSMessage(message), 461 MCSMessage(message),
460 base::Bind(&GCMStoreImplTest::UpdateCallback, 462 base::Bind(&GCMStoreImplTest::UpdateCallback,
461 base::Unretained(this)))); 463 base::Unretained(this))));
462 PumpLoop(); 464 PumpLoop();
463 } 465 }
464 } 466 }
465 467
466 } // namespace 468 } // namespace
467 469
468 } // namespace gcm 470 } // namespace gcm
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698