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 "chrome/browser/net/quota_policy_channel_id_store.h" | 5 #include "chrome/browser/net/quota_policy_channel_id_store.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
11 #include "base/files/scoped_temp_dir.h" | 11 #include "base/files/scoped_temp_dir.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
14 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
15 #include "base/single_thread_task_runner.h" | 15 #include "base/single_thread_task_runner.h" |
16 #include "base/stl_util.h" | 16 #include "base/stl_util.h" |
17 #include "base/threading/thread_task_runner_handle.h" | 17 #include "base/threading/thread_task_runner_handle.h" |
18 #include "base/time/time.h" | 18 #include "base/time/time.h" |
19 #include "content/public/test/mock_special_storage_policy.h" | |
20 #include "content/public/test/test_browser_thread_bundle.h" | 19 #include "content/public/test/test_browser_thread_bundle.h" |
21 #include "net/cookies/cookie_util.h" | 20 #include "net/cookies/cookie_util.h" |
22 #include "net/ssl/ssl_client_cert_type.h" | 21 #include "net/ssl/ssl_client_cert_type.h" |
23 #include "net/test/cert_test_util.h" | 22 #include "net/test/cert_test_util.h" |
24 #include "net/test/channel_id_test_util.h" | 23 #include "net/test/channel_id_test_util.h" |
25 #include "net/test/test_data_directory.h" | 24 #include "net/test/test_data_directory.h" |
26 #include "sql/statement.h" | 25 #include "sql/statement.h" |
| 26 #include "storage/browser/test/mock_special_storage_policy.h" |
27 #include "testing/gtest/include/gtest/gtest.h" | 27 #include "testing/gtest/include/gtest/gtest.h" |
28 | 28 |
29 const base::FilePath::CharType kTestChannelIDFilename[] = | 29 const base::FilePath::CharType kTestChannelIDFilename[] = |
30 FILE_PATH_LITERAL("ChannelID"); | 30 FILE_PATH_LITERAL("ChannelID"); |
31 | 31 |
32 class QuotaPolicyChannelIDStoreTest : public testing::Test { | 32 class QuotaPolicyChannelIDStoreTest : public testing::Test { |
33 public: | 33 public: |
34 void Load(std::vector<std::unique_ptr<net::DefaultChannelIDStore::ChannelID>>* | 34 void Load(std::vector<std::unique_ptr<net::DefaultChannelIDStore::ChannelID>>* |
35 channel_ids) { | 35 channel_ids) { |
36 base::RunLoop run_loop; | 36 base::RunLoop run_loop; |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 temp_dir_.GetPath().Append(kTestChannelIDFilename), | 183 temp_dir_.GetPath().Append(kTestChannelIDFilename), |
184 base::ThreadTaskRunnerHandle::Get(), NULL); | 184 base::ThreadTaskRunnerHandle::Get(), NULL); |
185 | 185 |
186 // Reload and check that the nonpersistent.com channel IDs have been removed. | 186 // Reload and check that the nonpersistent.com channel IDs have been removed. |
187 Load(&channel_ids); | 187 Load(&channel_ids); |
188 ASSERT_EQ(2U, channel_ids.size()); | 188 ASSERT_EQ(2U, channel_ids.size()); |
189 for (const auto& id : channel_ids) { | 189 for (const auto& id : channel_ids) { |
190 ASSERT_NE("nonpersistent.com", id->server_identifier()); | 190 ASSERT_NE("nonpersistent.com", id->server_identifier()); |
191 } | 191 } |
192 } | 192 } |
OLD | NEW |