Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(721)

Side by Side Diff: chrome/browser/android/offline_pages/offline_page_tab_helper_unittest.cc

Issue 1754333002: Switch to use Navigation events instead of provisional load events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Get DidFinishNavigation test working Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/android/offline_pages/offline_page_tab_helper.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « chrome/browser/android/offline_pages/offline_page_tab_helper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698