| 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 "components/offline_pages/offline_page_storage_manager.h" | 5 #include "components/offline_pages/offline_page_storage_manager.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 12 #include "components/offline_pages/client_policy_controller.h" | 12 #include "components/offline_pages/client_policy_controller.h" |
| 13 #include "components/offline_pages/offline_page_item.h" | 13 #include "components/offline_pages/offline_page_item.h" |
| 14 #include "components/offline_pages/offline_page_model.h" | 14 #include "components/offline_pages/offline_page_model.h" |
| 15 #include "components/offline_pages/offline_page_types.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 16 | 17 |
| 17 using DeletePageResult = offline_pages::OfflinePageModel::DeletePageResult; | |
| 18 | |
| 19 namespace offline_pages { | 18 namespace offline_pages { |
| 20 | 19 |
| 21 namespace { | 20 namespace { |
| 22 const char kTestClientNamespace[] = "CLIENT_NAMESPACE"; | 21 const char kTestClientNamespace[] = "CLIENT_NAMESPACE"; |
| 23 const GURL kTestUrl("http://example.com"); | 22 const GURL kTestUrl("http://example.com"); |
| 24 const GURL kTestUrl2("http://other.page.com"); | 23 const GURL kTestUrl2("http://other.page.com"); |
| 25 const base::FilePath::CharType kFilePath[] = FILE_PATH_LITERAL("TEST_FILEPATH"); | 24 const base::FilePath::CharType kFilePath[] = FILE_PATH_LITERAL("TEST_FILEPATH"); |
| 26 const ClientId kTestClientId1(kTestClientNamespace, "1234"); | 25 const ClientId kTestClientId1(kTestClientNamespace, "1234"); |
| 27 const ClientId kTestClientId2(kTestClientNamespace, "5678"); | 26 const ClientId kTestClientId2(kTestClientNamespace, "5678"); |
| 28 const int64_t kTestFileSize = 876543LL; | 27 const int64_t kTestFileSize = 876543LL; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 } | 109 } |
| 111 | 110 |
| 112 TEST_F(OfflinePageStorageManagerTest, TestClearPages) { | 111 TEST_F(OfflinePageStorageManagerTest, TestClearPages) { |
| 113 manager()->ClearPagesIfNeeded(base::Bind( | 112 manager()->ClearPagesIfNeeded(base::Bind( |
| 114 &OfflinePageStorageManagerTest::OnPagesCleared, base::Unretained(this))); | 113 &OfflinePageStorageManagerTest::OnPagesCleared, base::Unretained(this))); |
| 115 EXPECT_EQ(1, last_cleared_page_count()); | 114 EXPECT_EQ(1, last_cleared_page_count()); |
| 116 EXPECT_EQ(DeletePageResult::SUCCESS, last_delete_page_result()); | 115 EXPECT_EQ(DeletePageResult::SUCCESS, last_delete_page_result()); |
| 117 } | 116 } |
| 118 | 117 |
| 119 } // namespace offline_pages | 118 } // namespace offline_pages |
| OLD | NEW |