OLD | NEW |
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 "chrome/browser/android/offline_pages/offline_page_utils.h" | 5 #include "chrome/browser/android/offline_pages/offline_page_utils.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 OfflinePageUtilsTest::OfflinePageUtilsTest() | 92 OfflinePageUtilsTest::OfflinePageUtilsTest() |
93 : task_runner_(new base::TestSimpleTaskRunner), | 93 : task_runner_(new base::TestSimpleTaskRunner), |
94 task_runner_handle_(task_runner_) {} | 94 task_runner_handle_(task_runner_) {} |
95 | 95 |
96 OfflinePageUtilsTest::~OfflinePageUtilsTest() {} | 96 OfflinePageUtilsTest::~OfflinePageUtilsTest() {} |
97 | 97 |
98 void OfflinePageUtilsTest::SetUp() { | 98 void OfflinePageUtilsTest::SetUp() { |
99 // Enables offline pages feature. | 99 // Enables offline pages feature. |
100 // TODO(jianli): Remove this once the feature is completely enabled. | 100 // TODO(jianli): Remove this once the feature is completely enabled. |
101 base::FeatureList::ClearInstanceForTesting(); | 101 base::FeatureList::ClearInstanceForTesting(); |
102 scoped_ptr<base::FeatureList> feature_list(new base::FeatureList); | 102 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList); |
103 feature_list->InitializeFromCommandLine( | 103 feature_list->InitializeFromCommandLine( |
104 offline_pages::kOfflineBookmarksFeature.name, ""); | 104 offline_pages::kOfflineBookmarksFeature.name, ""); |
105 base::FeatureList::SetInstance(std::move(feature_list)); | 105 base::FeatureList::SetInstance(std::move(feature_list)); |
106 | 106 |
107 // Set up the factory for testing. | 107 // Set up the factory for testing. |
108 OfflinePageModelFactory::GetInstance()->SetTestingFactoryAndUse( | 108 OfflinePageModelFactory::GetInstance()->SetTestingFactoryAndUse( |
109 &profile_, BuildTestOfflinePageModel); | 109 &profile_, BuildTestOfflinePageModel); |
110 RunUntilIdle(); | 110 RunUntilIdle(); |
111 | 111 |
112 // Make sure the store contains the right offline pages before the load | 112 // Make sure the store contains the right offline pages before the load |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 TEST_F(OfflinePageUtilsTest, HasOfflinePageForOnlineURL) { | 228 TEST_F(OfflinePageUtilsTest, HasOfflinePageForOnlineURL) { |
229 EXPECT_TRUE( | 229 EXPECT_TRUE( |
230 OfflinePageUtils::HasOfflinePageForOnlineURL(profile(), kTestPage1Url)); | 230 OfflinePageUtils::HasOfflinePageForOnlineURL(profile(), kTestPage1Url)); |
231 EXPECT_TRUE( | 231 EXPECT_TRUE( |
232 OfflinePageUtils::HasOfflinePageForOnlineURL(profile(), kTestPage2Url)); | 232 OfflinePageUtils::HasOfflinePageForOnlineURL(profile(), kTestPage2Url)); |
233 EXPECT_FALSE( | 233 EXPECT_FALSE( |
234 OfflinePageUtils::HasOfflinePageForOnlineURL(profile(), kTestPage3Url)); | 234 OfflinePageUtils::HasOfflinePageForOnlineURL(profile(), kTestPage3Url)); |
235 } | 235 } |
236 | 236 |
237 } // namespace offline_pages | 237 } // namespace offline_pages |
OLD | NEW |