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

Side by Side Diff: webkit/tools/test_shell/test_shell.cc

Issue 150146: Add Reload and LoadData methods to WebFrame. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "V8Proxy.h" 5 #include "V8Proxy.h"
6 #undef LOG 6 #undef LOG
7 7
8 #include "webkit/tools/test_shell/test_shell.h" 8 #include "webkit/tools/test_shell/test_shell.h"
9 9
10 #include "base/base_paths.h" 10 #include "base/base_paths.h"
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 // A navigation resulting from loading a javascript URL should not be 519 // A navigation resulting from loading a javascript URL should not be
520 // treated as a browser initiated event. Instead, we want it to look as if 520 // treated as a browser initiated event. Instead, we want it to look as if
521 // the page initiated any load resulting from JS execution. 521 // the page initiated any load resulting from JS execution.
522 if (!entry.GetURL().SchemeIs("javascript")) { 522 if (!entry.GetURL().SchemeIs("javascript")) {
523 delegate_->set_pending_extra_data( 523 delegate_->set_pending_extra_data(
524 new TestShellExtraData(entry.GetPageID())); 524 new TestShellExtraData(entry.GetPageID()));
525 } 525 }
526 526
527 // If we are reloading, then WebKit will use the state of the current page. 527 // If we are reloading, then WebKit will use the state of the current page.
528 // Otherwise, we give it the state to navigate to. 528 // Otherwise, we give it the state to navigate to.
529 if (!reload && !entry.GetContentState().empty()) { 529 if (reload) {
530 frame->Reload();
531 } else if (!entry.GetContentState().empty()) {
530 DCHECK(entry.GetPageID() != -1); 532 DCHECK(entry.GetPageID() != -1);
531 frame->LoadHistoryItem( 533 frame->LoadHistoryItem(
532 webkit_glue::HistoryItemFromString(entry.GetContentState())); 534 webkit_glue::HistoryItemFromString(entry.GetContentState()));
533 } else { 535 } else {
534 WebURLRequest::CachePolicy cache_policy; 536 DCHECK(entry.GetPageID() == -1);
535 if (reload) { 537 frame->LoadRequest(WebURLRequest(entry.GetURL()));
536 cache_policy = WebURLRequest::ReloadIgnoringCacheData;
537 } else {
538 DCHECK(entry.GetPageID() == -1);
539 cache_policy = WebURLRequest::UseProtocolCachePolicy;
540 }
541
542 WebURLRequest request(entry.GetURL());
543 request.setCachePolicy(cache_policy);
544
545 frame->LoadRequest(request);
546 } 538 }
547 539
548 // In case LoadRequest failed before DidCreateDataSource was called. 540 // In case LoadRequest failed before DidCreateDataSource was called.
549 delegate_->set_pending_extra_data(NULL); 541 delegate_->set_pending_extra_data(NULL);
550 542
551 // Restore focus to the main frame prior to loading new request. 543 // Restore focus to the main frame prior to loading new request.
552 // This makes sure that we don't have a focused iframe. Otherwise, that 544 // This makes sure that we don't have a focused iframe. Otherwise, that
553 // iframe would keep focus when the SetFocus called immediately after 545 // iframe would keep focus when the SetFocus called immediately after
554 // LoadRequest, thus making some tests fail (see http://b/issue?id=845337 546 // LoadRequest, thus making some tests fail (see http://b/issue?id=845337
555 // for more details). 547 // for more details).
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 } 661 }
670 #endif // OS_WIN 662 #endif // OS_WIN
671 return false; 663 return false;
672 } 664 }
673 665
674 std::wstring GetWebKitLocale() { 666 std::wstring GetWebKitLocale() {
675 return L"en-US"; 667 return L"en-US";
676 } 668 }
677 669
678 } // namespace webkit_glue 670 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « webkit/tools/test_shell/plugin_tests.cc ('k') | webkit/tools/test_shell/test_webview_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698