| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 TestingProfile profile_; | 80 TestingProfile profile_; |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 OfflinePageUtilsTest::OfflinePageUtilsTest() | 83 OfflinePageUtilsTest::OfflinePageUtilsTest() |
| 84 : task_runner_(new base::TestSimpleTaskRunner), | 84 : task_runner_(new base::TestSimpleTaskRunner), |
| 85 task_runner_handle_(task_runner_) {} | 85 task_runner_handle_(task_runner_) {} |
| 86 | 86 |
| 87 OfflinePageUtilsTest::~OfflinePageUtilsTest() {} | 87 OfflinePageUtilsTest::~OfflinePageUtilsTest() {} |
| 88 | 88 |
| 89 void OfflinePageUtilsTest::SetUp() { | 89 void OfflinePageUtilsTest::SetUp() { |
| 90 // Enable offline pages feature. | 90 // Enables offline pages feature. |
| 91 // TODO(jianli): Remove this once the feature is completely enabled. |
| 91 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 92 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 92 switches::kEnableOfflinePages); | 93 switches::kEnableOfflinePages); |
| 93 | 94 |
| 94 // Set up the factory for testing. | 95 // Set up the factory for testing. |
| 95 OfflinePageModelFactory::GetInstance()->SetTestingFactoryAndUse( | 96 OfflinePageModelFactory::GetInstance()->SetTestingFactoryAndUse( |
| 96 &profile_, BuildTestOfflinePageModel); | 97 &profile_, BuildTestOfflinePageModel); |
| 97 RunUntilIdle(); | 98 RunUntilIdle(); |
| 98 | 99 |
| 99 // Make sure the store contains the right offline pages before the load | 100 // Make sure the store contains the right offline pages before the load |
| 100 // happens. | 101 // happens. |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 TEST_F(OfflinePageUtilsTest, HasOfflinePageForOnlineURL) { | 222 TEST_F(OfflinePageUtilsTest, HasOfflinePageForOnlineURL) { |
| 222 EXPECT_TRUE( | 223 EXPECT_TRUE( |
| 223 OfflinePageUtils::HasOfflinePageForOnlineURL(profile(), kTestPage1Url)); | 224 OfflinePageUtils::HasOfflinePageForOnlineURL(profile(), kTestPage1Url)); |
| 224 EXPECT_TRUE( | 225 EXPECT_TRUE( |
| 225 OfflinePageUtils::HasOfflinePageForOnlineURL(profile(), kTestPage2Url)); | 226 OfflinePageUtils::HasOfflinePageForOnlineURL(profile(), kTestPage2Url)); |
| 226 EXPECT_FALSE( | 227 EXPECT_FALSE( |
| 227 OfflinePageUtils::HasOfflinePageForOnlineURL(profile(), kTestPage3Url)); | 228 OfflinePageUtils::HasOfflinePageForOnlineURL(profile(), kTestPage3Url)); |
| 228 } | 229 } |
| 229 | 230 |
| 230 } // namespace offline_pages | 231 } // namespace offline_pages |
| OLD | NEW |