| 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 "chrome/browser/android/offline_pages/recent_tab_helper.h" | 5 #include "chrome/browser/android/offline_pages/recent_tab_helper.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
| 10 #include "base/test/scoped_feature_list.h" | 10 #include "base/test/scoped_feature_list.h" |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 scoped_feature_list_.InitAndEnableFeature(kOffliningRecentPagesFeature); | 182 scoped_feature_list_.InitAndEnableFeature(kOffliningRecentPagesFeature); |
| 183 // Sets up the factories for testing. | 183 // Sets up the factories for testing. |
| 184 OfflinePageModelFactory::GetInstance()->SetTestingFactoryAndUse( | 184 OfflinePageModelFactory::GetInstance()->SetTestingFactoryAndUse( |
| 185 browser_context(), BuildTestOfflinePageModel); | 185 browser_context(), BuildTestOfflinePageModel); |
| 186 RunUntilIdle(); | 186 RunUntilIdle(); |
| 187 RequestCoordinatorFactory::GetInstance()->SetTestingFactoryAndUse( | 187 RequestCoordinatorFactory::GetInstance()->SetTestingFactoryAndUse( |
| 188 browser_context(), BuildTestRequestCoordinator); | 188 browser_context(), BuildTestRequestCoordinator); |
| 189 RunUntilIdle(); | 189 RunUntilIdle(); |
| 190 | 190 |
| 191 RecentTabHelper::CreateForWebContents(web_contents()); | 191 RecentTabHelper::CreateForWebContents(web_contents()); |
| 192 recent_tab_helper_ = | 192 recent_tab_helper_ = RecentTabHelper::FromWebContents(web_contents()); |
| 193 RecentTabHelper::FromWebContents(web_contents()); | |
| 194 | 193 |
| 195 recent_tab_helper_->SetDelegate(base::MakeUnique<TestDelegate>( | 194 recent_tab_helper_->SetDelegate(base::MakeUnique<TestDelegate>( |
| 196 this, task_runner(), kTabId, true)); | 195 this, task_runner(), kTabId, true)); |
| 197 | 196 |
| 198 model_ = OfflinePageModelFactory::GetForBrowserContext(browser_context()); | 197 model_ = OfflinePageModelFactory::GetForBrowserContext(browser_context()); |
| 199 model_->AddObserver(this); | 198 model_->AddObserver(this); |
| 200 } | 199 } |
| 201 | 200 |
| 202 void RecentTabHelperTest::FailLoad(const GURL& url) { | 201 void RecentTabHelperTest::FailLoad(const GURL& url) { |
| 203 controller().LoadURL(url, content::Referrer(), ui::PAGE_TRANSITION_TYPED, | 202 controller().LoadURL(url, content::Referrer(), ui::PAGE_TRANSITION_TYPED, |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 GetAllPages(); | 545 GetAllPages(); |
| 547 ASSERT_EQ(1U, all_pages().size()); | 546 ASSERT_EQ(1U, all_pages().size()); |
| 548 const OfflinePageItem& page = all_pages()[0]; | 547 const OfflinePageItem& page = all_pages()[0]; |
| 549 EXPECT_EQ(kTestPageUrl, page.url); | 548 EXPECT_EQ(kTestPageUrl, page.url); |
| 550 EXPECT_EQ("download", page.client_id.name_space); | 549 EXPECT_EQ("download", page.client_id.name_space); |
| 551 EXPECT_EQ("id1", page.client_id.id); | 550 EXPECT_EQ("id1", page.client_id.id); |
| 552 EXPECT_EQ(153L, page.offline_id); | 551 EXPECT_EQ(153L, page.offline_id); |
| 553 } | 552 } |
| 554 | 553 |
| 555 } // namespace offline_pages | 554 } // namespace offline_pages |
| OLD | NEW |