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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/files/file_util.h" | 6 #include "base/files/file_util.h" |
7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 exploded_time.month = 12; | 60 exploded_time.month = 12; |
61 exploded_time.day_of_week = 0; // Unused. | 61 exploded_time.day_of_week = 0; // Unused. |
62 exploded_time.day_of_month = 13; | 62 exploded_time.day_of_month = 13; |
63 exploded_time.hour = 2; | 63 exploded_time.hour = 2; |
64 exploded_time.minute = 23; | 64 exploded_time.minute = 23; |
65 exploded_time.second = 45; | 65 exploded_time.second = 45; |
66 exploded_time.millisecond = 0; | 66 exploded_time.millisecond = 0; |
67 return base::Time::FromUTCExploded(exploded_time); | 67 return base::Time::FromUTCExploded(exploded_time); |
68 } | 68 } |
69 | 69 |
70 virtual void SetUp() { | 70 void SetUp() override { |
71 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 71 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
72 store_ = new QuotaPolicyChannelIDStore( | 72 store_ = new QuotaPolicyChannelIDStore( |
73 temp_dir_.path().Append(kTestChannelIDFilename), | 73 temp_dir_.path().Append(kTestChannelIDFilename), |
74 base::ThreadTaskRunnerHandle::Get(), | 74 base::ThreadTaskRunnerHandle::Get(), |
75 NULL); | 75 NULL); |
76 ScopedVector<net::DefaultChannelIDStore::ChannelID> channel_ids; | 76 ScopedVector<net::DefaultChannelIDStore::ChannelID> channel_ids; |
77 Load(&channel_ids); | 77 Load(&channel_ids); |
78 ASSERT_EQ(0u, channel_ids.size()); | 78 ASSERT_EQ(0u, channel_ids.size()); |
79 // Make sure the store gets written at least once. | 79 // Make sure the store gets written at least once. |
80 store_->AddChannelID( | 80 store_->AddChannelID( |
81 net::DefaultChannelIDStore::ChannelID("google.com", | 81 net::DefaultChannelIDStore::ChannelID("google.com", |
82 base::Time::FromInternalValue(1), | 82 base::Time::FromInternalValue(1), |
83 base::Time::FromInternalValue(2), | 83 base::Time::FromInternalValue(2), |
84 "a", | 84 "a", |
85 "b")); | 85 "b")); |
86 } | 86 } |
87 | 87 |
88 virtual void TearDown() { | 88 void TearDown() override { |
89 store_ = NULL; | 89 store_ = NULL; |
90 loop_.RunUntilIdle(); | 90 loop_.RunUntilIdle(); |
91 } | 91 } |
92 | 92 |
93 base::ScopedTempDir temp_dir_; | 93 base::ScopedTempDir temp_dir_; |
94 scoped_refptr<QuotaPolicyChannelIDStore> store_; | 94 scoped_refptr<QuotaPolicyChannelIDStore> store_; |
95 ScopedVector<net::DefaultChannelIDStore::ChannelID> channel_ids_; | 95 ScopedVector<net::DefaultChannelIDStore::ChannelID> channel_ids_; |
96 base::MessageLoop loop_; | 96 base::MessageLoop loop_; |
97 }; | 97 }; |
98 | 98 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 store_ = new QuotaPolicyChannelIDStore( | 194 store_ = new QuotaPolicyChannelIDStore( |
195 temp_dir_.path().Append(kTestChannelIDFilename), | 195 temp_dir_.path().Append(kTestChannelIDFilename), |
196 base::MessageLoopProxy::current(), | 196 base::MessageLoopProxy::current(), |
197 NULL); | 197 NULL); |
198 | 198 |
199 // Reload and check that the "foo.com" cert has been removed. | 199 // Reload and check that the "foo.com" cert has been removed. |
200 Load(&channel_ids); | 200 Load(&channel_ids); |
201 ASSERT_EQ(1U, channel_ids.size()); | 201 ASSERT_EQ(1U, channel_ids.size()); |
202 ASSERT_EQ("google.com", channel_ids[0]->server_identifier()); | 202 ASSERT_EQ("google.com", channel_ids[0]->server_identifier()); |
203 } | 203 } |
OLD | NEW |