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

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

Issue 2484223005: Store original request URL in offline page metadata table (Closed)
Patch Set: Address feedback Created 4 years, 1 month 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
(...skipping 12 matching lines...) Expand all
23 #include "testing/gtest/include/gtest/gtest.h" 23 #include "testing/gtest/include/gtest/gtest.h"
24 24
25 namespace offline_pages { 25 namespace offline_pages {
26 26
27 namespace { 27 namespace {
28 28
29 #define OFFLINE_PAGES_TABLE_V1 "offlinepages_v1" 29 #define OFFLINE_PAGES_TABLE_V1 "offlinepages_v1"
30 30
31 const char kTestClientNamespace[] = "CLIENT_NAMESPACE"; 31 const char kTestClientNamespace[] = "CLIENT_NAMESPACE";
32 const char kTestURL[] = "https://example.com"; 32 const char kTestURL[] = "https://example.com";
33 const char kOriginalTestURL[] = "https://example.com/foo";
33 const ClientId kTestClientId1(kTestClientNamespace, "1234"); 34 const ClientId kTestClientId1(kTestClientNamespace, "1234");
34 const ClientId kTestClientId2(kTestClientNamespace, "5678"); 35 const ClientId kTestClientId2(kTestClientNamespace, "5678");
35 const base::FilePath::CharType kFilePath[] = 36 const base::FilePath::CharType kFilePath[] =
36 FILE_PATH_LITERAL("/offline_pages/example_com.mhtml"); 37 FILE_PATH_LITERAL("/offline_pages/example_com.mhtml");
37 int64_t kFileSize = 234567LL; 38 int64_t kFileSize = 234567LL;
38 int64_t kOfflineId = 12345LL; 39 int64_t kOfflineId = 12345LL;
39 40
40 // Build a store with outdated schema to simulate the upgrading process. 41 // Build a store with outdated schema to simulate the upgrading process.
41 // TODO(romax): move it to sql_unittests. 42 // TODO(romax): move it to sql_unittests.
42 void BuildTestStoreWithSchemaFromM52(const base::FilePath& file) { 43 void BuildTestStoreWithSchemaFromM52(const base::FilePath& file) {
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 ASSERT_TRUE(statement.Run()); 174 ASSERT_TRUE(statement.Run());
174 ASSERT_TRUE(connection.DoesTableExist(OFFLINE_PAGES_TABLE_V1)); 175 ASSERT_TRUE(connection.DoesTableExist(OFFLINE_PAGES_TABLE_V1));
175 ASSERT_TRUE(connection.DoesColumnExist(OFFLINE_PAGES_TABLE_V1, "version")); 176 ASSERT_TRUE(connection.DoesColumnExist(OFFLINE_PAGES_TABLE_V1, "version"));
176 ASSERT_TRUE(connection.DoesColumnExist(OFFLINE_PAGES_TABLE_V1, "status")); 177 ASSERT_TRUE(connection.DoesColumnExist(OFFLINE_PAGES_TABLE_V1, "status"));
177 ASSERT_TRUE( 178 ASSERT_TRUE(
178 connection.DoesColumnExist(OFFLINE_PAGES_TABLE_V1, "user_initiated")); 179 connection.DoesColumnExist(OFFLINE_PAGES_TABLE_V1, "user_initiated"));
179 ASSERT_TRUE( 180 ASSERT_TRUE(
180 connection.DoesColumnExist(OFFLINE_PAGES_TABLE_V1, "offline_url")); 181 connection.DoesColumnExist(OFFLINE_PAGES_TABLE_V1, "offline_url"));
181 } 182 }
182 183
184 void BuildTestStoreWithSchemaFromM55(const base::FilePath& file) {
185 sql::Connection connection;
186 ASSERT_TRUE(
187 connection.Open(file.Append(FILE_PATH_LITERAL("OfflinePages.db"))));
188 ASSERT_TRUE(connection.is_open());
189 ASSERT_TRUE(connection.BeginTransaction());
190 ASSERT_TRUE(connection.Execute("CREATE TABLE " OFFLINE_PAGES_TABLE_V1
191 "(offline_id INTEGER PRIMARY KEY NOT NULL, "
192 "creation_time INTEGER NOT NULL, "
193 "file_size INTEGER NOT NULL, "
194 "last_access_time INTEGER NOT NULL, "
195 "access_count INTEGER NOT NULL, "
196 "expiration_time INTEGER NOT NULL DEFAULT 0, "
197 "client_namespace VARCHAR NOT NULL, "
198 "client_id VARCHAR NOT NULL, "
199 "online_url VARCHAR NOT NULL, "
200 "file_path VARCHAR NOT NULL, "
201 "title VARCHAR NOT NULL DEFAULT ''"
202 ")"));
203 ASSERT_TRUE(connection.CommitTransaction());
204 sql::Statement statement(connection.GetUniqueStatement(
205 "INSERT INTO " OFFLINE_PAGES_TABLE_V1
206 "(offline_id, creation_time, file_size, "
207 "last_access_time, access_count, client_namespace, "
208 "client_id, online_url, file_path, expiration_time, title) "
209 "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"));
210 statement.BindInt64(0, kOfflineId);
211 statement.BindInt(1, 0);
212 statement.BindInt64(2, kFileSize);
213 statement.BindInt(3, 0);
214 statement.BindInt(4, 1);
215 statement.BindCString(5, kTestClientNamespace);
216 statement.BindString(6, kTestClientId2.id);
217 statement.BindCString(7, kTestURL);
218 statement.BindString(8, base::FilePath(kFilePath).MaybeAsASCII());
219 statement.BindInt64(9, base::Time::Now().ToInternalValue());
220 statement.BindString16(10, base::UTF8ToUTF16("Test title"));
221 ASSERT_TRUE(statement.Run());
222 ASSERT_TRUE(connection.DoesTableExist(OFFLINE_PAGES_TABLE_V1));
223 ASSERT_TRUE(connection.DoesColumnExist(OFFLINE_PAGES_TABLE_V1, "title"));
224 }
225
183 class OfflinePageMetadataStoreFactory { 226 class OfflinePageMetadataStoreFactory {
184 public: 227 public:
185 OfflinePageMetadataStore* BuildStore(const base::FilePath& file_path) { 228 OfflinePageMetadataStore* BuildStore(const base::FilePath& file_path) {
186 OfflinePageMetadataStoreSQL* store = new OfflinePageMetadataStoreSQL( 229 OfflinePageMetadataStoreSQL* store = new OfflinePageMetadataStoreSQL(
187 base::ThreadTaskRunnerHandle::Get(), file_path); 230 base::ThreadTaskRunnerHandle::Get(), file_path);
188 return store; 231 return store;
189 } 232 }
190 233
191 OfflinePageMetadataStore* BuildStoreM52(const base::FilePath& file_path) { 234 OfflinePageMetadataStore* BuildStoreM52(const base::FilePath& file_path) {
192 BuildTestStoreWithSchemaFromM52(file_path); 235 BuildTestStoreWithSchemaFromM52(file_path);
193 OfflinePageMetadataStoreSQL* store = new OfflinePageMetadataStoreSQL( 236 OfflinePageMetadataStoreSQL* store = new OfflinePageMetadataStoreSQL(
194 base::ThreadTaskRunnerHandle::Get(), file_path); 237 base::ThreadTaskRunnerHandle::Get(), file_path);
195 return store; 238 return store;
196 } 239 }
197 240
198 OfflinePageMetadataStore* BuildStoreM53(const base::FilePath& file_path) { 241 OfflinePageMetadataStore* BuildStoreM53(const base::FilePath& file_path) {
199 BuildTestStoreWithSchemaFromM53(file_path); 242 BuildTestStoreWithSchemaFromM53(file_path);
200 OfflinePageMetadataStoreSQL* store = new OfflinePageMetadataStoreSQL( 243 OfflinePageMetadataStoreSQL* store = new OfflinePageMetadataStoreSQL(
201 base::ThreadTaskRunnerHandle::Get(), file_path); 244 base::ThreadTaskRunnerHandle::Get(), file_path);
202 return store; 245 return store;
203 } 246 }
204 247
205 OfflinePageMetadataStore* BuildStoreM54(const base::FilePath& file_path) { 248 OfflinePageMetadataStore* BuildStoreM54(const base::FilePath& file_path) {
206 BuildTestStoreWithSchemaFromM54(file_path); 249 BuildTestStoreWithSchemaFromM54(file_path);
207 OfflinePageMetadataStoreSQL* store = new OfflinePageMetadataStoreSQL( 250 OfflinePageMetadataStoreSQL* store = new OfflinePageMetadataStoreSQL(
208 base::ThreadTaskRunnerHandle::Get(), file_path); 251 base::ThreadTaskRunnerHandle::Get(), file_path);
209 return store; 252 return store;
210 } 253 }
254
255 OfflinePageMetadataStore* BuildStoreM55(const base::FilePath& file_path) {
256 BuildTestStoreWithSchemaFromM55(file_path);
257 OfflinePageMetadataStoreSQL* store = new OfflinePageMetadataStoreSQL(
258 base::ThreadTaskRunnerHandle::Get(), file_path);
259 return store;
260 }
211 }; 261 };
212 262
213 enum CalledCallback { NONE, LOAD, ADD, UPDATE, REMOVE, RESET }; 263 enum CalledCallback { NONE, LOAD, ADD, UPDATE, REMOVE, RESET };
214 enum Status { STATUS_NONE, STATUS_TRUE, STATUS_FALSE }; 264 enum Status { STATUS_NONE, STATUS_TRUE, STATUS_FALSE };
215 265
216 class OfflinePageMetadataStoreTest : public testing::Test { 266 class OfflinePageMetadataStoreTest : public testing::Test {
217 public: 267 public:
218 OfflinePageMetadataStoreTest(); 268 OfflinePageMetadataStoreTest();
219 ~OfflinePageMetadataStoreTest() override; 269 ~OfflinePageMetadataStoreTest() override;
220 270
221 void TearDown() override { 271 void TearDown() override {
222 // Wait for all the pieces of the store to delete itself properly. 272 // Wait for all the pieces of the store to delete itself properly.
223 PumpLoop(); 273 PumpLoop();
224 } 274 }
225 275
226 std::unique_ptr<OfflinePageMetadataStore> BuildStore(); 276 std::unique_ptr<OfflinePageMetadataStore> BuildStore();
227 std::unique_ptr<OfflinePageMetadataStore> BuildStoreWithSchemaFromM52(); 277 std::unique_ptr<OfflinePageMetadataStore> BuildStoreWithSchemaFromM52();
228 std::unique_ptr<OfflinePageMetadataStore> BuildStoreWithSchemaFromM53(); 278 std::unique_ptr<OfflinePageMetadataStore> BuildStoreWithSchemaFromM53();
229 std::unique_ptr<OfflinePageMetadataStore> BuildStoreWithSchemaFromM54(); 279 std::unique_ptr<OfflinePageMetadataStore> BuildStoreWithSchemaFromM54();
280 std::unique_ptr<OfflinePageMetadataStore> BuildStoreWithSchemaFromM55();
230 281
231 void PumpLoop(); 282 void PumpLoop();
232 283
233 void GetOfflinePagesCallback( 284 void GetOfflinePagesCallback(
234 OfflinePageMetadataStore::LoadStatus load_status, 285 OfflinePageMetadataStore::LoadStatus load_status,
235 const std::vector<OfflinePageItem>& offline_pages); 286 const std::vector<OfflinePageItem>& offline_pages);
236 void AddCallback(ItemActionStatus status); 287 void AddCallback(ItemActionStatus status);
237 void UpdateCallback(CalledCallback called_callback, 288 void UpdateCallback(CalledCallback called_callback,
238 std::unique_ptr<OfflinePagesUpdateResult> result); 289 std::unique_ptr<OfflinePagesUpdateResult> result);
239 void ResetCallback(bool status); 290 void ResetCallback(bool status);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 } 371 }
321 372
322 void OfflinePageMetadataStoreTest::CheckThatOfflinePageCanBeSaved( 373 void OfflinePageMetadataStoreTest::CheckThatOfflinePageCanBeSaved(
323 std::unique_ptr<OfflinePageMetadataStore> store) { 374 std::unique_ptr<OfflinePageMetadataStore> store) {
324 size_t store_size = offline_pages_.size(); 375 size_t store_size = offline_pages_.size();
325 OfflinePageItem offline_page(GURL(kTestURL), 1234LL, kTestClientId1, 376 OfflinePageItem offline_page(GURL(kTestURL), 1234LL, kTestClientId1,
326 base::FilePath(kFilePath), kFileSize); 377 base::FilePath(kFilePath), kFileSize);
327 offline_page.title = base::UTF8ToUTF16("a title"); 378 offline_page.title = base::UTF8ToUTF16("a title");
328 base::Time expiration_time = base::Time::Now(); 379 base::Time expiration_time = base::Time::Now();
329 offline_page.expiration_time = expiration_time; 380 offline_page.expiration_time = expiration_time;
381 offline_page.original_url = GURL(kOriginalTestURL);
330 382
331 store->AddOfflinePage(offline_page, 383 store->AddOfflinePage(offline_page,
332 base::Bind(&OfflinePageMetadataStoreTest::AddCallback, 384 base::Bind(&OfflinePageMetadataStoreTest::AddCallback,
333 base::Unretained(this))); 385 base::Unretained(this)));
334 PumpLoop(); 386 PumpLoop();
335 EXPECT_EQ(ADD, last_called_callback_); 387 EXPECT_EQ(ADD, last_called_callback_);
336 EXPECT_EQ(STATUS_TRUE, last_status_); 388 EXPECT_EQ(STATUS_TRUE, last_status_);
337 ClearResults(); 389 ClearResults();
338 390
339 // Close the store first to ensure file lock is removed. 391 // Close the store first to ensure file lock is removed.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 std::unique_ptr<OfflinePageMetadataStore> store( 444 std::unique_ptr<OfflinePageMetadataStore> store(
393 factory_.BuildStoreM53(temp_directory_.GetPath())); 445 factory_.BuildStoreM53(temp_directory_.GetPath()));
394 PumpLoop(); 446 PumpLoop();
395 store->GetOfflinePages( 447 store->GetOfflinePages(
396 base::Bind(&OfflinePageMetadataStoreTest::GetOfflinePagesCallback, 448 base::Bind(&OfflinePageMetadataStoreTest::GetOfflinePagesCallback,
397 base::Unretained(this))); 449 base::Unretained(this)));
398 PumpLoop(); 450 PumpLoop();
399 return store; 451 return store;
400 } 452 }
401 453
454 std::unique_ptr<OfflinePageMetadataStore>
455 OfflinePageMetadataStoreTest::BuildStoreWithSchemaFromM55() {
456 std::unique_ptr<OfflinePageMetadataStore> store(
457 factory_.BuildStoreM55(temp_directory_.GetPath()));
458 PumpLoop();
459 store->GetOfflinePages(
460 base::Bind(&OfflinePageMetadataStoreTest::GetOfflinePagesCallback,
461 base::Unretained(this)));
462 PumpLoop();
463 return store;
464 }
465
402 // Loads empty store and makes sure that there are no offline pages stored in 466 // Loads empty store and makes sure that there are no offline pages stored in
403 // it. 467 // it.
404 TEST_F(OfflinePageMetadataStoreTest, LoadEmptyStore) { 468 TEST_F(OfflinePageMetadataStoreTest, LoadEmptyStore) {
405 std::unique_ptr<OfflinePageMetadataStore> store(BuildStore()); 469 std::unique_ptr<OfflinePageMetadataStore> store(BuildStore());
406 EXPECT_EQ(LOAD, last_called_callback_); 470 EXPECT_EQ(LOAD, last_called_callback_);
407 EXPECT_EQ(STATUS_TRUE, last_status_); 471 EXPECT_EQ(STATUS_TRUE, last_status_);
408 EXPECT_EQ(0U, offline_pages_.size()); 472 EXPECT_EQ(0U, offline_pages_.size());
409 } 473 }
410 474
411 TEST_F(OfflinePageMetadataStoreTest, GetOfflinePagesFromInvalidStore) { 475 TEST_F(OfflinePageMetadataStoreTest, GetOfflinePagesFromInvalidStore) {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 // TODO(romax): Move this to sql_unittest. 576 // TODO(romax): Move this to sql_unittest.
513 TEST_F(OfflinePageMetadataStoreTest, LoadVersion54Store) { 577 TEST_F(OfflinePageMetadataStoreTest, LoadVersion54Store) {
514 std::unique_ptr<OfflinePageMetadataStore> store( 578 std::unique_ptr<OfflinePageMetadataStore> store(
515 BuildStoreWithSchemaFromM54()); 579 BuildStoreWithSchemaFromM54());
516 580
517 OfflinePageItem item = CheckThatStoreHasOneItem(); 581 OfflinePageItem item = CheckThatStoreHasOneItem();
518 582
519 CheckThatOfflinePageCanBeSaved(std::move(store)); 583 CheckThatOfflinePageCanBeSaved(std::move(store));
520 } 584 }
521 585
586 // Loads a string with schema from M55.
587 // Because for now we only reduce the number of fields it just makes sure there
588 // are no crashes in the process.
589 // TODO(romax): Move this to sql_unittest.
590 TEST_F(OfflinePageMetadataStoreTest, LoadVersion55Store) {
591 std::unique_ptr<OfflinePageMetadataStore> store(
592 BuildStoreWithSchemaFromM55());
593
594 OfflinePageItem item = CheckThatStoreHasOneItem();
595
596 CheckThatOfflinePageCanBeSaved(std::move(store));
597 }
598
522 // Adds metadata of an offline page into a store and then opens the store 599 // Adds metadata of an offline page into a store and then opens the store
523 // again to make sure that stored metadata survives store restarts. 600 // again to make sure that stored metadata survives store restarts.
524 TEST_F(OfflinePageMetadataStoreTest, AddOfflinePage) { 601 TEST_F(OfflinePageMetadataStoreTest, AddOfflinePage) {
525 CheckThatOfflinePageCanBeSaved(BuildStore()); 602 CheckThatOfflinePageCanBeSaved(BuildStore());
526 } 603 }
527 604
528 TEST_F(OfflinePageMetadataStoreTest, AddSameOfflinePageTwice) { 605 TEST_F(OfflinePageMetadataStoreTest, AddSameOfflinePageTwice) {
529 std::unique_ptr<OfflinePageMetadataStore> store(BuildStore()); 606 std::unique_ptr<OfflinePageMetadataStore> store(BuildStore());
530 607
531 OfflinePageItem offline_page(GURL(kTestURL), 1234LL, kTestClientId1, 608 OfflinePageItem offline_page(GURL(kTestURL), 1234LL, kTestClientId1,
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 EXPECT_EQ(0U, offline_pages_.size()); 688 EXPECT_EQ(0U, offline_pages_.size());
612 } 689 }
613 690
614 // Adds metadata of multiple offline pages into a store and removes some. 691 // Adds metadata of multiple offline pages into a store and removes some.
615 TEST_F(OfflinePageMetadataStoreTest, AddRemoveMultipleOfflinePages) { 692 TEST_F(OfflinePageMetadataStoreTest, AddRemoveMultipleOfflinePages) {
616 std::unique_ptr<OfflinePageMetadataStore> store(BuildStore()); 693 std::unique_ptr<OfflinePageMetadataStore> store(BuildStore());
617 694
618 // Add an offline page. 695 // Add an offline page.
619 OfflinePageItem offline_page_1(GURL(kTestURL), 12345LL, kTestClientId1, 696 OfflinePageItem offline_page_1(GURL(kTestURL), 12345LL, kTestClientId1,
620 base::FilePath(kFilePath), kFileSize); 697 base::FilePath(kFilePath), kFileSize);
621 base::FilePath file_path_2 =
622 base::FilePath(FILE_PATH_LITERAL("//other.page.com.mhtml"));
623 OfflinePageItem offline_page_2(GURL("https://other.page.com"), 5678LL,
624 kTestClientId2, file_path_2, 12345,
625 base::Time::Now());
626 offline_page_2.expiration_time = base::Time::Now();
627 store->AddOfflinePage(offline_page_1, 698 store->AddOfflinePage(offline_page_1,
628 base::Bind(&OfflinePageMetadataStoreTest::AddCallback, 699 base::Bind(&OfflinePageMetadataStoreTest::AddCallback,
629 base::Unretained(this))); 700 base::Unretained(this)));
630 PumpLoop(); 701 PumpLoop();
631 EXPECT_EQ(ADD, last_called_callback_); 702 EXPECT_EQ(ADD, last_called_callback_);
632 EXPECT_EQ(STATUS_TRUE, last_status_); 703 EXPECT_EQ(STATUS_TRUE, last_status_);
633 704
634 ClearResults(); 705 ClearResults();
635 706
636 // Add anther offline page. 707 // Add anther offline page.
708 base::FilePath file_path_2 =
709 base::FilePath(FILE_PATH_LITERAL("//other.page.com.mhtml"));
710 OfflinePageItem offline_page_2(GURL("https://other.page.com"), 5678LL,
711 kTestClientId2, file_path_2, 12345,
712 base::Time::Now());
713 offline_page_2.expiration_time = base::Time::Now();
714 offline_page_2.original_url = GURL("https://example.com/bar");
637 store->AddOfflinePage(offline_page_2, 715 store->AddOfflinePage(offline_page_2,
638 base::Bind(&OfflinePageMetadataStoreTest::AddCallback, 716 base::Bind(&OfflinePageMetadataStoreTest::AddCallback,
639 base::Unretained(this))); 717 base::Unretained(this)));
640 PumpLoop(); 718 PumpLoop();
641 EXPECT_EQ(ADD, last_called_callback_); 719 EXPECT_EQ(ADD, last_called_callback_);
642 EXPECT_EQ(STATUS_TRUE, last_status_); 720 EXPECT_EQ(STATUS_TRUE, last_status_);
643 721
644 ClearResults(); 722 ClearResults();
645 723
646 // Load the store. 724 // Load the store.
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 794
717 EXPECT_EQ(LOAD, last_called_callback_); 795 EXPECT_EQ(LOAD, last_called_callback_);
718 EXPECT_EQ(STATUS_TRUE, last_status_); 796 EXPECT_EQ(STATUS_TRUE, last_status_);
719 ASSERT_EQ(1U, offline_pages_.size()); 797 ASSERT_EQ(1U, offline_pages_.size());
720 EXPECT_EQ(offline_page, offline_pages_[0]); 798 EXPECT_EQ(offline_page, offline_pages_[0]);
721 799
722 // Then update some data. 800 // Then update some data.
723 offline_page.file_size = kFileSize + 1; 801 offline_page.file_size = kFileSize + 1;
724 offline_page.access_count++; 802 offline_page.access_count++;
725 offline_page.expiration_time = base::Time::Now(); 803 offline_page.expiration_time = base::Time::Now();
804 offline_page.original_url = GURL("https://example.com/bar");
726 std::vector<OfflinePageItem> items_to_update; 805 std::vector<OfflinePageItem> items_to_update;
727 items_to_update.push_back(offline_page); 806 items_to_update.push_back(offline_page);
728 store->UpdateOfflinePages( 807 store->UpdateOfflinePages(
729 items_to_update, base::Bind(&OfflinePageMetadataStoreTest::UpdateCallback, 808 items_to_update, base::Bind(&OfflinePageMetadataStoreTest::UpdateCallback,
730 base::Unretained(this), UPDATE)); 809 base::Unretained(this), UPDATE));
731 PumpLoop(); 810 PumpLoop();
732 EXPECT_EQ(UPDATE, last_called_callback_); 811 EXPECT_EQ(UPDATE, last_called_callback_);
733 EXPECT_EQ(STATUS_TRUE, last_status_); 812 EXPECT_EQ(STATUS_TRUE, last_status_);
734 ASSERT_TRUE(last_update_result() != nullptr); 813 ASSERT_TRUE(last_update_result() != nullptr);
735 EXPECT_EQ(1UL, last_update_result()->item_statuses.size()); 814 EXPECT_EQ(1UL, last_update_result()->item_statuses.size());
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 base::Unretained(this))); 878 base::Unretained(this)));
800 PumpLoop(); 879 PumpLoop();
801 880
802 EXPECT_EQ(LOAD, last_called_callback_); 881 EXPECT_EQ(LOAD, last_called_callback_);
803 EXPECT_EQ(STATUS_TRUE, last_status_); 882 EXPECT_EQ(STATUS_TRUE, last_status_);
804 ASSERT_EQ(0U, offline_pages_.size()); 883 ASSERT_EQ(0U, offline_pages_.size());
805 } 884 }
806 885
807 } // namespace 886 } // namespace
808 } // namespace offline_pages 887 } // namespace offline_pages
OLDNEW
« no previous file with comments | « components/offline_pages/offline_page_item.cc ('k') | components/offline_pages/offline_page_metadata_store_sql.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698