OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/compiler_specific.h" | 5 #include "base/compiler_specific.h" |
6 #include "base/time/time.h" | 6 #include "base/time/time.h" |
7 #include "components/precache/core/precache_session_table.h" | 7 #include "components/precache/core/precache_session_table.h" |
8 #include "components/precache/core/proto/unfinished_work.pb.h" | 8 #include "components/precache/core/proto/unfinished_work.pb.h" |
9 #include "sql/connection.h" | 9 #include "sql/connection.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 std::unique_ptr<PrecacheSessionTable> precache_session_table_; | 30 std::unique_ptr<PrecacheSessionTable> precache_session_table_; |
31 std::unique_ptr<sql::Connection> db_; | 31 std::unique_ptr<sql::Connection> db_; |
32 }; | 32 }; |
33 | 33 |
34 TEST_F(PrecacheSessionTableTest, SaveAndGetUnfinishedWork) { | 34 TEST_F(PrecacheSessionTableTest, SaveAndGetUnfinishedWork) { |
35 std::unique_ptr<PrecacheUnfinishedWork> unfinished_work( | 35 std::unique_ptr<PrecacheUnfinishedWork> unfinished_work( |
36 new PrecacheUnfinishedWork()); | 36 new PrecacheUnfinishedWork()); |
37 unfinished_work->add_top_host()->set_hostname("foo.com"); | 37 unfinished_work->add_top_host()->set_hostname("foo.com"); |
38 unfinished_work->add_top_host()->set_hostname("bar.com"); | 38 unfinished_work->add_top_host()->set_hostname("bar.com"); |
39 auto s = unfinished_work->mutable_config_settings(); | 39 auto* s = unfinished_work->mutable_config_settings(); |
40 s->set_top_sites_count(11); | 40 s->set_top_sites_count(11); |
41 s->add_forced_site("baz.com"); | 41 s->add_forced_site("baz.com"); |
42 s->set_top_resources_count(12); | 42 s->set_top_resources_count(12); |
43 s->set_max_bytes_per_resource(501); | 43 s->set_max_bytes_per_resource(501); |
44 s->set_max_bytes_total(1001); | 44 s->set_max_bytes_total(1001); |
45 unfinished_work->add_manifest()->set_url("http://a.com/"); | 45 unfinished_work->add_manifest()->set_url("http://a.com/"); |
46 unfinished_work->add_manifest()->set_url("http://b.com/"); | 46 unfinished_work->add_manifest()->set_url("http://b.com/"); |
47 unfinished_work->add_manifest()->set_url("http://c.com/"); | 47 unfinished_work->add_manifest()->set_url("http://c.com/"); |
48 unfinished_work->add_resource()->set_url("http://x.com/"); | 48 unfinished_work->add_resource()->set_url("http://x.com/"); |
49 unfinished_work->add_resource()->set_url("http://y.com/"); | 49 unfinished_work->add_resource()->set_url("http://y.com/"); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 | 141 |
142 std::unique_ptr<PrecacheUnfinishedWork> unfinished_work2 = | 142 std::unique_ptr<PrecacheUnfinishedWork> unfinished_work2 = |
143 precache_session_table_->GetUnfinishedWork(); | 143 precache_session_table_->GetUnfinishedWork(); |
144 | 144 |
145 EXPECT_EQ(0, unfinished_work2->manifest_size()); | 145 EXPECT_EQ(0, unfinished_work2->manifest_size()); |
146 } | 146 } |
147 | 147 |
148 } // namespace | 148 } // namespace |
149 | 149 |
150 } // namespace precache | 150 } // namespace precache |
OLD | NEW |