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

Unified Diff: webkit/tools/test_shell/test_shell.cc

Issue 113758: Remove the HistoryState property of WebRequest.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/glue/weburlrequest_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/tools/test_shell/test_shell.cc
===================================================================
--- webkit/tools/test_shell/test_shell.cc (revision 16741)
+++ webkit/tools/test_shell/test_shell.cc (working copy)
@@ -494,51 +494,53 @@
}
bool TestShell::Navigate(const TestNavigationEntry& entry, bool reload) {
+ // Get the right target frame for the entry.
+ WebFrame* frame = webView()->GetMainFrame();
+ if (!entry.GetTargetFrame().empty())
+ frame = webView()->GetFrameWithName(entry.GetTargetFrame());
+ // TODO(mpcomplete): should we clear the target frame, or should
+ // back/forward navigations maintain the target frame?
+
+ // A navigation resulting from loading a javascript URL should not be
+ // treated as a browser initiated event. Instead, we want it to look as if
+ // the page initiated any load resulting from JS execution.
+ if (!entry.GetURL().SchemeIs("javascript")) {
+ delegate_->set_pending_extra_data(
+ new TestShellExtraData(entry.GetPageID()));
+ }
+
+ // If we are reloading, then WebKit will use the state of the current page.
+ // Otherwise, we give it the state to navigate to.
+ if (!reload && !entry.GetContentState().empty()) {
+ DCHECK(entry.GetPageID() != -1);
+ frame->LoadHistoryState(entry.GetContentState());
+ } else {
WebRequestCachePolicy cache_policy;
if (reload) {
cache_policy = WebRequestReloadIgnoringCacheData;
- } else if (entry.GetPageID() != -1) {
- cache_policy = WebRequestReturnCacheDataElseLoad;
} else {
+ DCHECK(entry.GetPageID() == -1);
cache_policy = WebRequestUseProtocolCachePolicy;
}
scoped_ptr<WebRequest> request(WebRequest::Create(entry.GetURL()));
request->SetCachePolicy(cache_policy);
- // If we are reloading, then WebKit will use the state of the current page.
- // Otherwise, we give it the state to navigate to.
- if (!reload)
- request->SetHistoryState(entry.GetContentState());
- // A navigation resulting from loading a javascript URL should not be
- // treated as a browser initiated event. Instead, we want it to look as if
- // the page initiated any load resulting from JS execution.
- if (!entry.GetURL().SchemeIs("javascript")) {
- delegate_->set_pending_extra_data(
- new TestShellExtraData(entry.GetPageID()));
- }
-
- // Get the right target frame for the entry.
- WebFrame* frame = webView()->GetMainFrame();
- if (!entry.GetTargetFrame().empty())
- frame = webView()->GetFrameWithName(entry.GetTargetFrame());
- // TODO(mpcomplete): should we clear the target frame, or should
- // back/forward navigations maintain the target frame?
-
frame->LoadRequest(request.get());
+ }
- // In case LoadRequest failed before DidCreateDataSource was called.
- delegate_->set_pending_extra_data(NULL);
+ // In case LoadRequest failed before DidCreateDataSource was called.
+ delegate_->set_pending_extra_data(NULL);
- // Restore focus to the main frame prior to loading new request.
- // This makes sure that we don't have a focused iframe. Otherwise, that
- // iframe would keep focus when the SetFocus called immediately after
- // LoadRequest, thus making some tests fail (see http://b/issue?id=845337
- // for more details).
- webView()->SetFocusedFrame(frame);
- SetFocus(webViewHost(), true);
+ // Restore focus to the main frame prior to loading new request.
+ // This makes sure that we don't have a focused iframe. Otherwise, that
+ // iframe would keep focus when the SetFocus called immediately after
+ // LoadRequest, thus making some tests fail (see http://b/issue?id=845337
+ // for more details).
+ webView()->SetFocusedFrame(frame);
+ SetFocus(webViewHost(), true);
- return true;
+ return true;
}
void TestShell::GoBackOrForward(int offset) {
« no previous file with comments | « webkit/glue/weburlrequest_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698