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

Side by Side Diff: third_party/WebKit/Source/core/frame/FrameTestHelpers.cpp

Issue 2940863005: Move loading methods from WebFrame to WebLocalFrame. (Closed)
Patch Set: Created 3 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 } 84 }
85 } 85 }
86 86
87 TestWebWidgetClient* DefaultWebWidgetClient() { 87 TestWebWidgetClient* DefaultWebWidgetClient() {
88 DEFINE_STATIC_LOCAL(TestWebWidgetClient, client, ()); 88 DEFINE_STATIC_LOCAL(TestWebWidgetClient, client, ());
89 return &client; 89 return &client;
90 } 90 }
91 91
92 } // namespace 92 } // namespace
93 93
94 void LoadFrame(WebFrame* frame, const std::string& url) { 94 void LoadFrame(WebLocalFrame* frame, const std::string& url) {
95 WebURLRequest url_request(URLTestHelpers::ToKURL(url)); 95 WebURLRequest url_request(URLTestHelpers::ToKURL(url));
96 frame->LoadRequest(url_request); 96 frame->LoadRequest(url_request);
97 PumpPendingRequestsForFrameToLoad(frame); 97 PumpPendingRequestsForFrameToLoad(frame);
98 } 98 }
99 99
100 void LoadHTMLString(WebLocalFrame* frame, 100 void LoadHTMLString(WebLocalFrame* frame,
101 const std::string& html, 101 const std::string& html,
102 const WebURL& base_url) { 102 const WebURL& base_url) {
103 frame->LoadHTMLString(WebData(html.data(), html.size()), base_url); 103 frame->LoadHTMLString(WebData(html.data(), html.size()), base_url);
104 PumpPendingRequestsForFrameToLoad(frame); 104 PumpPendingRequestsForFrameToLoad(frame);
105 } 105 }
106 106
107 void LoadHistoryItem(WebFrame* frame, 107 void LoadHistoryItem(WebLocalFrame* frame,
108 const WebHistoryItem& item, 108 const WebHistoryItem& item,
109 WebHistoryLoadType load_type, 109 WebHistoryLoadType load_type,
110 WebCachePolicy cache_policy) { 110 WebCachePolicy cache_policy) {
111 WebURLRequest request = 111 WebURLRequest request = frame->RequestFromHistoryItem(item, cache_policy);
112 frame->ToWebLocalFrame()->RequestFromHistoryItem(item, cache_policy); 112 frame->Load(request, WebFrameLoadType::kBackForward, item);
113 frame->ToWebLocalFrame()->Load(request, WebFrameLoadType::kBackForward, item);
114 PumpPendingRequestsForFrameToLoad(frame); 113 PumpPendingRequestsForFrameToLoad(frame);
115 } 114 }
116 115
117 void ReloadFrame(WebFrame* frame) { 116 void ReloadFrame(WebLocalFrame* frame) {
118 frame->Reload(WebFrameLoadType::kReload); 117 frame->Reload(WebFrameLoadType::kReload);
119 PumpPendingRequestsForFrameToLoad(frame); 118 PumpPendingRequestsForFrameToLoad(frame);
120 } 119 }
121 120
122 void ReloadFrameBypassingCache(WebFrame* frame) { 121 void ReloadFrameBypassingCache(WebLocalFrame* frame) {
123 frame->Reload(WebFrameLoadType::kReloadBypassingCache); 122 frame->Reload(WebFrameLoadType::kReloadBypassingCache);
124 PumpPendingRequestsForFrameToLoad(frame); 123 PumpPendingRequestsForFrameToLoad(frame);
125 } 124 }
126 125
127 void PumpPendingRequestsForFrameToLoad(WebFrame* frame) { 126 void PumpPendingRequestsForFrameToLoad(WebFrame* frame) {
128 Platform::Current()->CurrentThread()->GetWebTaskRunner()->PostTask( 127 Platform::Current()->CurrentThread()->GetWebTaskRunner()->PostTask(
129 BLINK_FROM_HERE, WTF::Bind(&RunServeAsyncRequestsTask)); 128 BLINK_FROM_HERE, WTF::Bind(&RunServeAsyncRequestsTask));
130 testing::EnterRunLoop(); 129 testing::EnterRunLoop();
131 } 130 }
132 131
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 WebViewBase* WebViewHelper::InitializeAndLoad( 288 WebViewBase* WebViewHelper::InitializeAndLoad(
290 const std::string& url, 289 const std::string& url,
291 bool enable_javascript, 290 bool enable_javascript,
292 TestWebFrameClient* web_frame_client, 291 TestWebFrameClient* web_frame_client,
293 TestWebViewClient* web_view_client, 292 TestWebViewClient* web_view_client,
294 TestWebWidgetClient* web_widget_client, 293 TestWebWidgetClient* web_widget_client,
295 void (*update_settings_func)(WebSettings*)) { 294 void (*update_settings_func)(WebSettings*)) {
296 Initialize(enable_javascript, web_frame_client, web_view_client, 295 Initialize(enable_javascript, web_frame_client, web_view_client,
297 web_widget_client, update_settings_func); 296 web_widget_client, update_settings_func);
298 297
299 LoadFrame(WebView()->MainFrame(), url); 298 LoadFrame(WebView()->MainFrameImpl(), url);
300 299
301 return WebView(); 300 return WebView();
302 } 301 }
303 302
304 void WebViewHelper::Reset() { 303 void WebViewHelper::Reset() {
305 if (web_view_) { 304 if (web_view_) {
306 DCHECK(!TestWebFrameClient::IsLoading()); 305 DCHECK(!TestWebFrameClient::IsLoading());
307 web_view_->WillCloseLayerTreeView(); 306 web_view_->WillCloseLayerTreeView();
308 web_view_->Close(); 307 web_view_->Close();
309 web_view_ = nullptr; 308 web_view_ = nullptr;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 test_web_view_client_->ScheduleAnimation(); 391 test_web_view_client_->ScheduleAnimation();
393 } 392 }
394 393
395 void TestWebViewWidgetClient::DidMeaningfulLayout( 394 void TestWebViewWidgetClient::DidMeaningfulLayout(
396 WebMeaningfulLayout layout_type) { 395 WebMeaningfulLayout layout_type) {
397 test_web_view_client_->DidMeaningfulLayout(layout_type); 396 test_web_view_client_->DidMeaningfulLayout(layout_type);
398 } 397 }
399 398
400 } // namespace FrameTestHelpers 399 } // namespace FrameTestHelpers
401 } // namespace blink 400 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698