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

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

Issue 115486: Take 2 at fixing relativeanchor-{basic,frames}.html.... (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/tools/layout_tests/test_expectations.txt ('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 (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 // This file contains the implementation of TestWebViewDelegate, which serves 5 // This file contains the implementation of TestWebViewDelegate, which serves
6 // as the WebViewDelegate for the TestShellWebHost. The host is expected to 6 // as the WebViewDelegate for the TestShellWebHost. The host is expected to
7 // have initialized a MessageLoop before these methods are called. 7 // have initialized a MessageLoop before these methods are called.
8 8
9 #include "config.h" 9 #include "config.h"
10 10
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 if (!dataSource) 787 if (!dataSource)
788 return; 788 return;
789 789
790 SetAddressBarURL(dataSource->GetRequest().GetMainDocumentURL()); 790 SetAddressBarURL(dataSource->GetRequest().GetMainDocumentURL());
791 } 791 }
792 792
793 void TestWebViewDelegate::LocationChangeDone(WebFrame* frame) { 793 void TestWebViewDelegate::LocationChangeDone(WebFrame* frame) {
794 if (frame == top_loading_frame_) { 794 if (frame == top_loading_frame_) {
795 top_loading_frame_ = NULL; 795 top_loading_frame_ = NULL;
796 796
797 // It is important to update the content state for the current navigation
798 // entry in case we are done with the test and need to dump the back/
799 // forward list.
800 std::string state;
801 if (shell_->webView()->GetMainFrame()->GetCurrentHistoryState(&state)) {
802 TestNavigationEntry* entry =
803 shell_->navigation_controller()->GetLastCommittedEntry();
804 if (entry)
805 entry->SetContentState(state);
806 }
807
808 if (shell_->layout_test_mode()) 797 if (shell_->layout_test_mode())
809 shell_->layout_test_controller()->LocationChangeDone(); 798 shell_->layout_test_controller()->LocationChangeDone();
810 } 799 }
811 } 800 }
812 801
813 WebWidgetHost* TestWebViewDelegate::GetHostForWidget(WebWidget* webwidget) { 802 WebWidgetHost* TestWebViewDelegate::GetHostForWidget(WebWidget* webwidget) {
814 if (webwidget == shell_->webView()) 803 if (webwidget == shell_->webView())
815 return shell_->webViewHost(); 804 return shell_->webViewHost();
816 if (webwidget == shell_->popup()) 805 if (webwidget == shell_->popup())
817 return shell_->popupHost(); 806 return shell_->popupHost();
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 846
858 // Bug 654101: the referrer will be empty on https->http transitions. It 847 // Bug 654101: the referrer will be empty on https->http transitions. It
859 // would be nice if we could get the real referrer from somewhere. 848 // would be nice if we could get the real referrer from somewhere.
860 entry->SetPageID(page_id_); 849 entry->SetPageID(page_id_);
861 if (ds->HasUnreachableURL()) { 850 if (ds->HasUnreachableURL()) {
862 entry->SetURL(GURL(ds->GetUnreachableURL())); 851 entry->SetURL(GURL(ds->GetUnreachableURL()));
863 } else { 852 } else {
864 entry->SetURL(GURL(request.GetURL())); 853 entry->SetURL(GURL(request.GetURL()));
865 } 854 }
866 855
856 std::string state;
857 if (frame->GetCurrentHistoryState(&state))
858 entry->SetContentState(state);
859
867 shell_->navigation_controller()->DidNavigateToEntry(entry.release()); 860 shell_->navigation_controller()->DidNavigateToEntry(entry.release());
868 861
869 last_page_id_updated_ = std::max(last_page_id_updated_, page_id_); 862 last_page_id_updated_ = std::max(last_page_id_updated_, page_id_);
870 } 863 }
871 864
872 void TestWebViewDelegate::UpdateSessionHistory(WebFrame* frame) { 865 void TestWebViewDelegate::UpdateSessionHistory(WebFrame* frame) {
873 // If we have a valid page ID at this point, then it corresponds to the page 866 // If we have a valid page ID at this point, then it corresponds to the page
874 // we are navigating away from. Otherwise, this is the first navigation, so 867 // we are navigating away from. Otherwise, this is the first navigation, so
875 // there is no past session history to record. 868 // there is no past session history to record.
876 if (page_id_ == -1) 869 if (page_id_ == -1)
(...skipping 18 matching lines...) Expand all
895 return L"main frame \"" + name + L"\""; 888 return L"main frame \"" + name + L"\"";
896 else 889 else
897 return L"main frame"; 890 return L"main frame";
898 } else { 891 } else {
899 if (name.length()) 892 if (name.length())
900 return L"frame \"" + name + L"\""; 893 return L"frame \"" + name + L"\"";
901 else 894 else
902 return L"frame (anonymous)"; 895 return L"frame (anonymous)";
903 } 896 }
904 } 897 }
OLDNEW
« no previous file with comments | « webkit/tools/layout_tests/test_expectations.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698