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

Side by Side Diff: components/offline_pages/offline_page_metadata_store_impl_unittest.cc

Issue 2019333008: [Offline Pages] Fix crash due to table inconsistency. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments from jianli@ Created 4 years, 6 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/offline_pages/offline_page_metadata_store.h" 5 #include "components/offline_pages/offline_page_metadata_store.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/files/scoped_temp_dir.h" 13 #include "base/files/scoped_temp_dir.h"
14 #include "base/strings/string_number_conversions.h" 14 #include "base/strings/string_number_conversions.h"
15 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
16 #include "base/test/test_simple_task_runner.h" 16 #include "base/test/test_simple_task_runner.h"
17 #include "base/threading/thread_task_runner_handle.h" 17 #include "base/threading/thread_task_runner_handle.h"
18 #include "components/offline_pages/offline_page_item.h" 18 #include "components/offline_pages/offline_page_item.h"
19 #include "components/offline_pages/offline_page_metadata_store_sql.h" 19 #include "components/offline_pages/offline_page_metadata_store_sql.h"
20 #include "components/offline_pages/offline_page_model.h" 20 #include "components/offline_pages/offline_page_model.h"
21 #include "sql/connection.h"
22 #include "sql/statement.h"
21 #include "testing/gtest/include/gtest/gtest.h" 23 #include "testing/gtest/include/gtest/gtest.h"
22 24
23 namespace offline_pages { 25 namespace offline_pages {
24 26
25 namespace { 27 namespace {
26 28
29 #define OFFLINE_PAGES_TABLE_V1 "offlinepages_v1"
30
27 const char kTestClientNamespace[] = "CLIENT_NAMESPACE"; 31 const char kTestClientNamespace[] = "CLIENT_NAMESPACE";
28 const char kTestURL[] = "https://example.com"; 32 const char kTestURL[] = "https://example.com";
29 const ClientId kTestClientId1(kTestClientNamespace, "1234"); 33 const ClientId kTestClientId1(kTestClientNamespace, "1234");
30 const ClientId kTestClientId2(kTestClientNamespace, "5678"); 34 const ClientId kTestClientId2(kTestClientNamespace, "5678");
31 const base::FilePath::CharType kFilePath[] = 35 const base::FilePath::CharType kFilePath[] =
32 FILE_PATH_LITERAL("/offline_pages/example_com.mhtml"); 36 FILE_PATH_LITERAL("/offline_pages/example_com.mhtml");
33 int64_t kFileSize = 234567; 37 int64_t kFileSize = 234567LL;
38 int64_t kOfflineId = 12345LL;
39
40 // Build a store with outdated schema to simulate the upgrading process.
41 // TODO(romax): move it to sql_unittests.
42 void BuildTestStoreWithOutdatedSchema(const base::FilePath& file) {
43 sql::Connection connection;
44 ASSERT_TRUE(
45 connection.Open(file.Append(FILE_PATH_LITERAL("OfflinePages.db"))));
46 ASSERT_TRUE(connection.is_open());
47 ASSERT_TRUE(connection.BeginTransaction());
48 ASSERT_TRUE(connection.Execute("CREATE TABLE " OFFLINE_PAGES_TABLE_V1
49 "(offline_id INTEGER PRIMARY KEY NOT NULL, "
50 "creation_time INTEGER NOT NULL, "
51 "file_size INTEGER NOT NULL, "
52 "version INTEGER NOT NULL, "
53 "last_access_time INTEGER NOT NULL, "
54 "access_count INTEGER NOT NULL, "
55 "status INTEGER NOT NULL DEFAULT 0, "
56 "user_initiated INTEGER, "
57 "client_namespace VARCHAR NOT NULL, "
58 "client_id VARCHAR NOT NULL, "
59 "online_url VARCHAR NOT NULL, "
60 "offline_url VARCHAR NOT NULL DEFAULT '', "
61 "file_path VARCHAR NOT NULL "
62 ")"));
63 ASSERT_TRUE(connection.CommitTransaction());
64 sql::Statement statement(connection.GetUniqueStatement(
65 "INSERT INTO " OFFLINE_PAGES_TABLE_V1
66 "(offline_id, creation_time, file_size, version, "
67 "last_access_time, access_count, client_namespace, "
68 "client_id, online_url, file_path) "
69 "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"));
70 statement.BindInt64(0, kOfflineId);
71 statement.BindInt(1, 0);
72 statement.BindInt64(2, kFileSize);
73 statement.BindInt(3, 0);
74 statement.BindInt(4, 0);
75 statement.BindInt(5, 1);
76 statement.BindCString(6, kTestClientNamespace);
77 statement.BindString(7, kTestClientId2.id);
78 statement.BindCString(8, kTestURL);
79 statement.BindString(9, base::FilePath(kFilePath).MaybeAsASCII());
80 ASSERT_TRUE(statement.Run());
81 ASSERT_TRUE(connection.DoesTableExist(OFFLINE_PAGES_TABLE_V1));
82 ASSERT_FALSE(
83 connection.DoesColumnExist(OFFLINE_PAGES_TABLE_V1, "expiration_time"));
84 }
34 85
35 class OfflinePageMetadataStoreFactory { 86 class OfflinePageMetadataStoreFactory {
36 public: 87 public:
37 virtual OfflinePageMetadataStore* BuildStore(const base::FilePath& file) = 0; 88 virtual OfflinePageMetadataStore* BuildStore(const base::FilePath& file) = 0;
89 virtual OfflinePageMetadataStore* BuildStoreV1(
90 const base::FilePath& file) = 0;
38 }; 91 };
39 92
40 class OfflinePageMetadataStoreSQLFactory 93 class OfflinePageMetadataStoreSQLFactory
41 : public OfflinePageMetadataStoreFactory { 94 : public OfflinePageMetadataStoreFactory {
42 public: 95 public:
43 OfflinePageMetadataStore* BuildStore(const base::FilePath& file) override { 96 OfflinePageMetadataStore* BuildStore(const base::FilePath& file) override {
44 OfflinePageMetadataStoreSQL* store = new OfflinePageMetadataStoreSQL( 97 OfflinePageMetadataStoreSQL* store = new OfflinePageMetadataStoreSQL(
45 base::ThreadTaskRunnerHandle::Get(), file); 98 base::ThreadTaskRunnerHandle::Get(), file);
46 return store; 99 return store;
47 } 100 }
101
102 OfflinePageMetadataStore* BuildStoreV1(const base::FilePath& file) override {
103 BuildTestStoreWithOutdatedSchema(file);
104 OfflinePageMetadataStoreSQL* store = new OfflinePageMetadataStoreSQL(
105 base::ThreadTaskRunnerHandle::Get(), file);
106 return store;
107 }
48 }; 108 };
49 109
50 enum CalledCallback { NONE, LOAD, ADD, REMOVE, DESTROY }; 110 enum CalledCallback { NONE, LOAD, ADD, REMOVE, DESTROY };
51 enum Status { STATUS_NONE, STATUS_TRUE, STATUS_FALSE }; 111 enum Status { STATUS_NONE, STATUS_TRUE, STATUS_FALSE };
52 112
53 class OfflinePageMetadataStoreTestBase : public testing::Test { 113 class OfflinePageMetadataStoreTestBase : public testing::Test {
54 public: 114 public:
55 OfflinePageMetadataStoreTestBase(); 115 OfflinePageMetadataStoreTestBase();
56 ~OfflinePageMetadataStoreTestBase() override; 116 ~OfflinePageMetadataStoreTestBase() override;
57 117
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 void OfflinePageMetadataStoreTestBase::ClearResults() { 172 void OfflinePageMetadataStoreTestBase::ClearResults() {
113 last_called_callback_ = NONE; 173 last_called_callback_ = NONE;
114 last_status_ = STATUS_NONE; 174 last_status_ = STATUS_NONE;
115 offline_pages_.clear(); 175 offline_pages_.clear();
116 } 176 }
117 177
118 template <typename T> 178 template <typename T>
119 class OfflinePageMetadataStoreTest : public OfflinePageMetadataStoreTestBase { 179 class OfflinePageMetadataStoreTest : public OfflinePageMetadataStoreTestBase {
120 public: 180 public:
121 std::unique_ptr<OfflinePageMetadataStore> BuildStore(); 181 std::unique_ptr<OfflinePageMetadataStore> BuildStore();
182 std::unique_ptr<OfflinePageMetadataStore>
183 BuildStoreWithUpgradeFromOutdatedSchema();
122 184
123 protected: 185 protected:
124 T factory_; 186 T factory_;
125 }; 187 };
126 188
127 template <typename T> 189 template <typename T>
128 std::unique_ptr<OfflinePageMetadataStore> 190 std::unique_ptr<OfflinePageMetadataStore>
129 OfflinePageMetadataStoreTest<T>::BuildStore() { 191 OfflinePageMetadataStoreTest<T>::BuildStore() {
130 std::unique_ptr<OfflinePageMetadataStore> store( 192 std::unique_ptr<OfflinePageMetadataStore> store(
131 factory_.BuildStore(temp_directory_.path())); 193 factory_.BuildStore(temp_directory_.path()));
132 store->Load(base::Bind(&OfflinePageMetadataStoreTestBase::LoadCallback, 194 store->Load(base::Bind(&OfflinePageMetadataStoreTestBase::LoadCallback,
133 base::Unretained(this))); 195 base::Unretained(this)));
134 PumpLoop(); 196 PumpLoop();
135 return store; 197 return store;
136 } 198 }
137 199
200 template <typename T>
201 std::unique_ptr<OfflinePageMetadataStore>
202 OfflinePageMetadataStoreTest<T>::BuildStoreWithUpgradeFromOutdatedSchema() {
203 std::unique_ptr<OfflinePageMetadataStore> store(
204 factory_.BuildStoreV1(temp_directory_.path()));
205 store->Load(base::Bind(&OfflinePageMetadataStoreTestBase::LoadCallback,
206 base::Unretained(this)));
207 PumpLoop();
208 return store;
209 }
210
138 typedef testing::Types<OfflinePageMetadataStoreSQLFactory> MyTypes; 211 typedef testing::Types<OfflinePageMetadataStoreSQLFactory> MyTypes;
139 TYPED_TEST_CASE(OfflinePageMetadataStoreTest, MyTypes); 212 TYPED_TEST_CASE(OfflinePageMetadataStoreTest, MyTypes);
140 213
141 // Loads empty store and makes sure that there are no offline pages stored in 214 // Loads empty store and makes sure that there are no offline pages stored in
142 // it. 215 // it.
143 TYPED_TEST(OfflinePageMetadataStoreTest, LoadEmptyStore) { 216 TYPED_TEST(OfflinePageMetadataStoreTest, LoadEmptyStore) {
144 std::unique_ptr<OfflinePageMetadataStore> store(this->BuildStore()); 217 std::unique_ptr<OfflinePageMetadataStore> store(this->BuildStore());
145 EXPECT_EQ(LOAD, this->last_called_callback_); 218 EXPECT_EQ(LOAD, this->last_called_callback_);
146 EXPECT_EQ(STATUS_TRUE, this->last_status_); 219 EXPECT_EQ(STATUS_TRUE, this->last_status_);
147 EXPECT_EQ(0U, this->offline_pages_.size()); 220 EXPECT_EQ(0U, this->offline_pages_.size());
148 } 221 }
149 222
223 // Loads a store which has an outdated schema.
224 // This test case would crash if it's not handling correctly when we're loading
225 // old version stores.
226 // TODO(romax): Move this to sql_unittest.
227 TYPED_TEST(OfflinePageMetadataStoreTest, LoadPreviousVersionStore) {
228 std::unique_ptr<OfflinePageMetadataStore> store(
229 this->BuildStoreWithUpgradeFromOutdatedSchema());
230 EXPECT_EQ(LOAD, this->last_called_callback_);
231 EXPECT_EQ(STATUS_TRUE, this->last_status_);
232 EXPECT_EQ(1U, this->offline_pages_.size());
233 OfflinePageItem offline_page(GURL(kTestURL), 1234LL, kTestClientId1,
234 base::FilePath(kFilePath), kFileSize);
235 base::Time expiration_time = base::Time::Now();
236 offline_page.expiration_time = expiration_time;
237 store->AddOrUpdateOfflinePage(
238 offline_page,
239 base::Bind(&OfflinePageMetadataStoreTestBase::UpdateCallback,
240 base::Unretained(this), ADD));
241 this->PumpLoop();
242 EXPECT_EQ(ADD, this->last_called_callback_);
243 EXPECT_EQ(STATUS_TRUE, this->last_status_);
244 this->ClearResults();
245
246 // Close the store first to ensure file lock is removed.
247 store.reset();
248 store = this->BuildStore();
249 this->PumpLoop();
250
251 EXPECT_EQ(LOAD, this->last_called_callback_);
252 EXPECT_EQ(STATUS_TRUE, this->last_status_);
253 ASSERT_EQ(2U, this->offline_pages_.size());
254 if (this->offline_pages_[0].offline_id != offline_page.offline_id) {
255 std::swap(this->offline_pages_[0], this->offline_pages_[1]);
256 }
257 EXPECT_EQ(offline_page.url, this->offline_pages_[0].url);
258 EXPECT_EQ(offline_page.offline_id, this->offline_pages_[0].offline_id);
259 EXPECT_EQ(offline_page.file_path, this->offline_pages_[0].file_path);
260 EXPECT_EQ(offline_page.last_access_time,
261 this->offline_pages_[0].last_access_time);
262 EXPECT_EQ(offline_page.expiration_time,
263 this->offline_pages_[0].expiration_time);
264 EXPECT_EQ(offline_page.client_id, this->offline_pages_[0].client_id);
265 EXPECT_EQ(kOfflineId, this->offline_pages_[1].offline_id);
266 EXPECT_EQ(kFileSize, this->offline_pages_[1].file_size);
267 EXPECT_EQ(kTestClientId2, this->offline_pages_[1].client_id);
268 }
269
150 // Adds metadata of an offline page into a store and then opens the store 270 // Adds metadata of an offline page into a store and then opens the store
151 // again to make sure that stored metadata survives store restarts. 271 // again to make sure that stored metadata survives store restarts.
152 TYPED_TEST(OfflinePageMetadataStoreTest, AddOfflinePage) { 272 TYPED_TEST(OfflinePageMetadataStoreTest, AddOfflinePage) {
153 std::unique_ptr<OfflinePageMetadataStore> store(this->BuildStore()); 273 std::unique_ptr<OfflinePageMetadataStore> store(this->BuildStore());
154 OfflinePageItem offline_page(GURL(kTestURL), 1234LL, kTestClientId1, 274 OfflinePageItem offline_page(GURL(kTestURL), 1234LL, kTestClientId1,
155 base::FilePath(kFilePath), kFileSize); 275 base::FilePath(kFilePath), kFileSize);
156 store->AddOrUpdateOfflinePage( 276 store->AddOrUpdateOfflinePage(
157 offline_page, 277 offline_page,
158 base::Bind(&OfflinePageMetadataStoreTestBase::UpdateCallback, 278 base::Bind(&OfflinePageMetadataStoreTestBase::UpdateCallback,
159 base::Unretained(this), ADD)); 279 base::Unretained(this), ADD));
160 this->PumpLoop(); 280 this->PumpLoop();
161 EXPECT_EQ(ADD, this->last_called_callback_); 281 EXPECT_EQ(ADD, this->last_called_callback_);
162 EXPECT_EQ(STATUS_TRUE, this->last_status_); 282 EXPECT_EQ(STATUS_TRUE, this->last_status_);
163 283
164 this->ClearResults(); 284 this->ClearResults();
165 285
166 // Close the store first to ensure file lock is removed. 286 // Close the store first to ensure file lock is removed.
167 store.reset(); 287 store.reset();
168 store = this->BuildStore(); 288 store = this->BuildStore();
169 this->PumpLoop(); 289 this->PumpLoop();
170 290
171 EXPECT_EQ(LOAD, this->last_called_callback_); 291 EXPECT_EQ(LOAD, this->last_called_callback_);
172 EXPECT_EQ(STATUS_TRUE, this->last_status_); 292 EXPECT_EQ(STATUS_TRUE, this->last_status_);
173 EXPECT_EQ(1U, this->offline_pages_.size()); 293 ASSERT_EQ(1U, this->offline_pages_.size());
174 EXPECT_EQ(offline_page.url, this->offline_pages_[0].url); 294 EXPECT_EQ(offline_page.url, this->offline_pages_[0].url);
175 EXPECT_EQ(offline_page.offline_id, this->offline_pages_[0].offline_id); 295 EXPECT_EQ(offline_page.offline_id, this->offline_pages_[0].offline_id);
176 EXPECT_EQ(offline_page.version, this->offline_pages_[0].version); 296 EXPECT_EQ(offline_page.version, this->offline_pages_[0].version);
177 EXPECT_EQ(offline_page.file_path, this->offline_pages_[0].file_path); 297 EXPECT_EQ(offline_page.file_path, this->offline_pages_[0].file_path);
178 EXPECT_EQ(offline_page.file_size, this->offline_pages_[0].file_size); 298 EXPECT_EQ(offline_page.file_size, this->offline_pages_[0].file_size);
179 EXPECT_EQ(offline_page.creation_time, this->offline_pages_[0].creation_time); 299 EXPECT_EQ(offline_page.creation_time, this->offline_pages_[0].creation_time);
180 EXPECT_EQ(offline_page.last_access_time, 300 EXPECT_EQ(offline_page.last_access_time,
181 this->offline_pages_[0].last_access_time); 301 this->offline_pages_[0].last_access_time);
182 EXPECT_EQ(offline_page.expiration_time, 302 EXPECT_EQ(offline_page.expiration_time,
183 this->offline_pages_[0].expiration_time); 303 this->offline_pages_[0].expiration_time);
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 418
299 // Close and reload the store. 419 // Close and reload the store.
300 store.reset(); 420 store.reset();
301 store = this->BuildStore(); 421 store = this->BuildStore();
302 store->Load(base::Bind(&OfflinePageMetadataStoreTestBase::LoadCallback, 422 store->Load(base::Bind(&OfflinePageMetadataStoreTestBase::LoadCallback,
303 base::Unretained(this))); 423 base::Unretained(this)));
304 this->PumpLoop(); 424 this->PumpLoop();
305 425
306 EXPECT_EQ(LOAD, this->last_called_callback_); 426 EXPECT_EQ(LOAD, this->last_called_callback_);
307 EXPECT_EQ(STATUS_TRUE, this->last_status_); 427 EXPECT_EQ(STATUS_TRUE, this->last_status_);
308 EXPECT_EQ(1U, this->offline_pages_.size()); 428 ASSERT_EQ(1U, this->offline_pages_.size());
309 EXPECT_EQ(offline_page_2.url, this->offline_pages_[0].url); 429 EXPECT_EQ(offline_page_2.url, this->offline_pages_[0].url);
310 EXPECT_EQ(offline_page_2.offline_id, this->offline_pages_[0].offline_id); 430 EXPECT_EQ(offline_page_2.offline_id, this->offline_pages_[0].offline_id);
311 EXPECT_EQ(offline_page_2.version, this->offline_pages_[0].version); 431 EXPECT_EQ(offline_page_2.version, this->offline_pages_[0].version);
312 EXPECT_EQ(offline_page_2.file_path, this->offline_pages_[0].file_path); 432 EXPECT_EQ(offline_page_2.file_path, this->offline_pages_[0].file_path);
313 EXPECT_EQ(offline_page_2.file_size, this->offline_pages_[0].file_size); 433 EXPECT_EQ(offline_page_2.file_size, this->offline_pages_[0].file_size);
314 EXPECT_EQ(offline_page_2.creation_time, 434 EXPECT_EQ(offline_page_2.creation_time,
315 this->offline_pages_[0].creation_time); 435 this->offline_pages_[0].creation_time);
316 EXPECT_EQ(offline_page_2.last_access_time, 436 EXPECT_EQ(offline_page_2.last_access_time,
317 this->offline_pages_[0].last_access_time); 437 this->offline_pages_[0].last_access_time);
318 EXPECT_EQ(offline_page_2.expiration_time, 438 EXPECT_EQ(offline_page_2.expiration_time,
(...skipping 17 matching lines...) Expand all
336 EXPECT_EQ(ADD, this->last_called_callback_); 456 EXPECT_EQ(ADD, this->last_called_callback_);
337 EXPECT_EQ(STATUS_TRUE, this->last_status_); 457 EXPECT_EQ(STATUS_TRUE, this->last_status_);
338 458
339 this->ClearResults(); 459 this->ClearResults();
340 store->Load(base::Bind(&OfflinePageMetadataStoreTestBase::LoadCallback, 460 store->Load(base::Bind(&OfflinePageMetadataStoreTestBase::LoadCallback,
341 base::Unretained(this))); 461 base::Unretained(this)));
342 this->PumpLoop(); 462 this->PumpLoop();
343 463
344 EXPECT_EQ(LOAD, this->last_called_callback_); 464 EXPECT_EQ(LOAD, this->last_called_callback_);
345 EXPECT_EQ(STATUS_TRUE, this->last_status_); 465 EXPECT_EQ(STATUS_TRUE, this->last_status_);
346 EXPECT_EQ(1U, this->offline_pages_.size()); 466 ASSERT_EQ(1U, this->offline_pages_.size());
347 EXPECT_EQ(offline_page.url, this->offline_pages_[0].url); 467 EXPECT_EQ(offline_page.url, this->offline_pages_[0].url);
348 EXPECT_EQ(offline_page.offline_id, this->offline_pages_[0].offline_id); 468 EXPECT_EQ(offline_page.offline_id, this->offline_pages_[0].offline_id);
349 EXPECT_EQ(offline_page.version, this->offline_pages_[0].version); 469 EXPECT_EQ(offline_page.version, this->offline_pages_[0].version);
350 EXPECT_EQ(offline_page.file_path, this->offline_pages_[0].file_path); 470 EXPECT_EQ(offline_page.file_path, this->offline_pages_[0].file_path);
351 EXPECT_EQ(offline_page.file_size, this->offline_pages_[0].file_size); 471 EXPECT_EQ(offline_page.file_size, this->offline_pages_[0].file_size);
352 EXPECT_EQ(offline_page.creation_time, this->offline_pages_[0].creation_time); 472 EXPECT_EQ(offline_page.creation_time, this->offline_pages_[0].creation_time);
353 EXPECT_EQ(offline_page.last_access_time, 473 EXPECT_EQ(offline_page.last_access_time,
354 this->offline_pages_[0].last_access_time); 474 this->offline_pages_[0].last_access_time);
355 EXPECT_EQ(offline_page.expiration_time, 475 EXPECT_EQ(offline_page.expiration_time,
356 this->offline_pages_[0].expiration_time); 476 this->offline_pages_[0].expiration_time);
(...skipping 12 matching lines...) Expand all
369 EXPECT_EQ(ADD, this->last_called_callback_); 489 EXPECT_EQ(ADD, this->last_called_callback_);
370 EXPECT_EQ(STATUS_TRUE, this->last_status_); 490 EXPECT_EQ(STATUS_TRUE, this->last_status_);
371 491
372 this->ClearResults(); 492 this->ClearResults();
373 store->Load(base::Bind(&OfflinePageMetadataStoreTestBase::LoadCallback, 493 store->Load(base::Bind(&OfflinePageMetadataStoreTestBase::LoadCallback,
374 base::Unretained(this))); 494 base::Unretained(this)));
375 this->PumpLoop(); 495 this->PumpLoop();
376 496
377 EXPECT_EQ(LOAD, this->last_called_callback_); 497 EXPECT_EQ(LOAD, this->last_called_callback_);
378 EXPECT_EQ(STATUS_TRUE, this->last_status_); 498 EXPECT_EQ(STATUS_TRUE, this->last_status_);
379 EXPECT_EQ(1U, this->offline_pages_.size()); 499 ASSERT_EQ(1U, this->offline_pages_.size());
380 EXPECT_EQ(offline_page.url, this->offline_pages_[0].url); 500 EXPECT_EQ(offline_page.url, this->offline_pages_[0].url);
381 EXPECT_EQ(offline_page.offline_id, this->offline_pages_[0].offline_id); 501 EXPECT_EQ(offline_page.offline_id, this->offline_pages_[0].offline_id);
382 EXPECT_EQ(offline_page.version, this->offline_pages_[0].version); 502 EXPECT_EQ(offline_page.version, this->offline_pages_[0].version);
383 EXPECT_EQ(offline_page.file_path, this->offline_pages_[0].file_path); 503 EXPECT_EQ(offline_page.file_path, this->offline_pages_[0].file_path);
384 EXPECT_EQ(offline_page.file_size, this->offline_pages_[0].file_size); 504 EXPECT_EQ(offline_page.file_size, this->offline_pages_[0].file_size);
385 EXPECT_EQ(offline_page.creation_time, this->offline_pages_[0].creation_time); 505 EXPECT_EQ(offline_page.creation_time, this->offline_pages_[0].creation_time);
386 EXPECT_EQ(offline_page.last_access_time, 506 EXPECT_EQ(offline_page.last_access_time,
387 this->offline_pages_[0].last_access_time); 507 this->offline_pages_[0].last_access_time);
388 EXPECT_EQ(offline_page.expiration_time, 508 EXPECT_EQ(offline_page.expiration_time,
389 this->offline_pages_[0].expiration_time); 509 this->offline_pages_[0].expiration_time);
390 EXPECT_EQ(offline_page.access_count, this->offline_pages_[0].access_count); 510 EXPECT_EQ(offline_page.access_count, this->offline_pages_[0].access_count);
391 EXPECT_EQ(offline_page.client_id, this->offline_pages_[0].client_id); 511 EXPECT_EQ(offline_page.client_id, this->offline_pages_[0].client_id);
392 } 512 }
393 513
394 } // namespace 514 } // namespace
395 } // namespace offline_pages 515 } // namespace offline_pages
OLDNEW
« no previous file with comments | « components/offline_pages/BUILD.gn ('k') | components/offline_pages/offline_page_metadata_store_sql.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698