| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 network_change_notifier_->set_online(online); | 126 network_change_notifier_->set_online(online); |
| 127 } | 127 } |
| 128 | 128 |
| 129 void OfflinePageTabHelperTest::StartLoad(const GURL& url) { | 129 void OfflinePageTabHelperTest::StartLoad(const GURL& url) { |
| 130 controller().LoadURL(url, content::Referrer(), ui::PAGE_TRANSITION_TYPED, | 130 controller().LoadURL(url, content::Referrer(), ui::PAGE_TRANSITION_TYPED, |
| 131 std::string()); | 131 std::string()); |
| 132 } | 132 } |
| 133 | 133 |
| 134 void OfflinePageTabHelperTest::CommitLoad(const GURL& url) { | 134 void OfflinePageTabHelperTest::CommitLoad(const GURL& url) { |
| 135 int entry_id = controller().GetPendingEntry()->GetUniqueID(); | 135 int entry_id = controller().GetPendingEntry()->GetUniqueID(); |
| 136 content::RenderFrameHostTester::For(main_rfh())->SendNavigate( | 136 content::RenderFrameHostTester::For(main_rfh()) |
| 137 0, entry_id, true, url); | 137 ->SendNavigate(0, entry_id, true, url); |
| 138 } | 138 } |
| 139 | 139 |
| 140 void OfflinePageTabHelperTest::FailLoad(const GURL& url) { | 140 void OfflinePageTabHelperTest::FailLoad(const GURL& url) { |
| 141 content::RenderFrameHostTester::For(main_rfh())->SimulateNavigationError( | 141 content::RenderFrameHostTester::For(main_rfh())->SimulateNavigationStart(url); |
| 142 url, net::ERR_INTERNET_DISCONNECTED); | 142 // Set up the error code for the failed navigation. |
| 143 content::RenderFrameHostTester::For(main_rfh())-> |
| 144 SimulateNavigationError(url, net::ERR_INTERNET_DISCONNECTED); |
| 145 content::RenderFrameHostTester::For(main_rfh())-> |
| 146 SimulateNavigationErrorPageCommit(); |
| 143 // Gives a chance to run delayed task to do redirection. | 147 // Gives a chance to run delayed task to do redirection. |
| 144 RunUntilIdle(); | 148 RunUntilIdle(); |
| 145 } | 149 } |
| 146 | 150 |
| 147 void OfflinePageTabHelperTest::SetLastPathCreatedByArchiver( | 151 void OfflinePageTabHelperTest::SetLastPathCreatedByArchiver( |
| 148 const base::FilePath& file_path) { | 152 const base::FilePath& file_path) { |
| 149 } | 153 } |
| 150 | 154 |
| 151 scoped_ptr<OfflinePageTestArchiver> OfflinePageTabHelperTest::BuildArchiver( | 155 scoped_ptr<OfflinePageTestArchiver> OfflinePageTabHelperTest::BuildArchiver( |
| 152 const GURL& url, | 156 const GURL& url, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 GURL online_url = page->url; | 190 GURL online_url = page->url; |
| 187 | 191 |
| 188 StartLoad(online_url); | 192 StartLoad(online_url); |
| 189 EXPECT_EQ(online_url, controller().GetPendingEntry()->GetURL()); | 193 EXPECT_EQ(online_url, controller().GetPendingEntry()->GetURL()); |
| 190 | 194 |
| 191 FailLoad(online_url); | 195 FailLoad(online_url); |
| 192 EXPECT_EQ(offline_url, controller().GetPendingEntry()->GetURL()); | 196 EXPECT_EQ(offline_url, controller().GetPendingEntry()->GetURL()); |
| 193 } | 197 } |
| 194 | 198 |
| 195 } // namespace offline_pages | 199 } // namespace offline_pages |
| OLD | NEW |