| OLD | NEW |
| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 std::unique_ptr<T> CreateDefaultClientIfNeeded(T*& client) { | 90 std::unique_ptr<T> CreateDefaultClientIfNeeded(T*& client) { |
| 91 if (client) | 91 if (client) |
| 92 return nullptr; | 92 return nullptr; |
| 93 auto owned_client = WTF::MakeUnique<T>(); | 93 auto owned_client = WTF::MakeUnique<T>(); |
| 94 client = owned_client.get(); | 94 client = owned_client.get(); |
| 95 return owned_client; | 95 return owned_client; |
| 96 } | 96 } |
| 97 | 97 |
| 98 } // namespace | 98 } // namespace |
| 99 | 99 |
| 100 void LoadFrame(WebFrame* frame, const std::string& url) { | 100 void LoadFrame(WebLocalFrame* frame, const std::string& url) { |
| 101 WebURLRequest url_request(URLTestHelpers::ToKURL(url)); | 101 WebURLRequest url_request(URLTestHelpers::ToKURL(url)); |
| 102 frame->LoadRequest(url_request); | 102 frame->LoadRequest(url_request); |
| 103 PumpPendingRequestsForFrameToLoad(frame); | 103 PumpPendingRequestsForFrameToLoad(frame); |
| 104 } | 104 } |
| 105 | 105 |
| 106 void LoadHTMLString(WebLocalFrame* frame, | 106 void LoadHTMLString(WebLocalFrame* frame, |
| 107 const std::string& html, | 107 const std::string& html, |
| 108 const WebURL& base_url) { | 108 const WebURL& base_url) { |
| 109 frame->LoadHTMLString(WebData(html.data(), html.size()), base_url); | 109 frame->LoadHTMLString(WebData(html.data(), html.size()), base_url); |
| 110 PumpPendingRequestsForFrameToLoad(frame); | 110 PumpPendingRequestsForFrameToLoad(frame); |
| 111 } | 111 } |
| 112 | 112 |
| 113 void LoadHistoryItem(WebFrame* frame, | 113 void LoadHistoryItem(WebLocalFrame* frame, |
| 114 const WebHistoryItem& item, | 114 const WebHistoryItem& item, |
| 115 WebHistoryLoadType load_type, | 115 WebHistoryLoadType load_type, |
| 116 WebCachePolicy cache_policy) { | 116 WebCachePolicy cache_policy) { |
| 117 WebURLRequest request = | 117 WebURLRequest request = frame->RequestFromHistoryItem(item, cache_policy); |
| 118 frame->ToWebLocalFrame()->RequestFromHistoryItem(item, cache_policy); | 118 frame->Load(request, WebFrameLoadType::kBackForward, item); |
| 119 frame->ToWebLocalFrame()->Load(request, WebFrameLoadType::kBackForward, item); | |
| 120 PumpPendingRequestsForFrameToLoad(frame); | 119 PumpPendingRequestsForFrameToLoad(frame); |
| 121 } | 120 } |
| 122 | 121 |
| 123 void ReloadFrame(WebFrame* frame) { | 122 void ReloadFrame(WebLocalFrame* frame) { |
| 124 frame->Reload(WebFrameLoadType::kReload); | 123 frame->Reload(WebFrameLoadType::kReload); |
| 125 PumpPendingRequestsForFrameToLoad(frame); | 124 PumpPendingRequestsForFrameToLoad(frame); |
| 126 } | 125 } |
| 127 | 126 |
| 128 void ReloadFrameBypassingCache(WebFrame* frame) { | 127 void ReloadFrameBypassingCache(WebLocalFrame* frame) { |
| 129 frame->Reload(WebFrameLoadType::kReloadBypassingCache); | 128 frame->Reload(WebFrameLoadType::kReloadBypassingCache); |
| 130 PumpPendingRequestsForFrameToLoad(frame); | 129 PumpPendingRequestsForFrameToLoad(frame); |
| 131 } | 130 } |
| 132 | 131 |
| 133 void PumpPendingRequestsForFrameToLoad(WebFrame* frame) { | 132 void PumpPendingRequestsForFrameToLoad(WebFrame* frame) { |
| 134 Platform::Current()->CurrentThread()->GetWebTaskRunner()->PostTask( | 133 Platform::Current()->CurrentThread()->GetWebTaskRunner()->PostTask( |
| 135 BLINK_FROM_HERE, WTF::Bind(&RunServeAsyncRequestsTask)); | 134 BLINK_FROM_HERE, WTF::Bind(&RunServeAsyncRequestsTask)); |
| 136 testing::EnterRunLoop(); | 135 testing::EnterRunLoop(); |
| 137 } | 136 } |
| 138 | 137 |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 | 286 |
| 288 WebViewBase* WebViewHelper::InitializeAndLoad( | 287 WebViewBase* WebViewHelper::InitializeAndLoad( |
| 289 const std::string& url, | 288 const std::string& url, |
| 290 TestWebFrameClient* web_frame_client, | 289 TestWebFrameClient* web_frame_client, |
| 291 TestWebViewClient* web_view_client, | 290 TestWebViewClient* web_view_client, |
| 292 TestWebWidgetClient* web_widget_client, | 291 TestWebWidgetClient* web_widget_client, |
| 293 void (*update_settings_func)(WebSettings*)) { | 292 void (*update_settings_func)(WebSettings*)) { |
| 294 Initialize(web_frame_client, web_view_client, web_widget_client, | 293 Initialize(web_frame_client, web_view_client, web_widget_client, |
| 295 update_settings_func); | 294 update_settings_func); |
| 296 | 295 |
| 297 LoadFrame(WebView()->MainFrame(), url); | 296 LoadFrame(WebView()->MainFrameImpl(), url); |
| 298 | 297 |
| 299 return WebView(); | 298 return WebView(); |
| 300 } | 299 } |
| 301 | 300 |
| 302 WebViewBase* WebViewHelper::InitializeRemote( | 301 WebViewBase* WebViewHelper::InitializeRemote( |
| 303 TestWebRemoteFrameClient* web_remote_frame_client, | 302 TestWebRemoteFrameClient* web_remote_frame_client, |
| 304 RefPtr<SecurityOrigin> security_origin, | 303 RefPtr<SecurityOrigin> security_origin, |
| 305 TestWebViewClient* web_view_client) { | 304 TestWebViewClient* web_view_client) { |
| 306 Reset(); | 305 Reset(); |
| 307 | 306 |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 test_web_view_client_.ScheduleAnimation(); | 445 test_web_view_client_.ScheduleAnimation(); |
| 447 } | 446 } |
| 448 | 447 |
| 449 void TestWebViewWidgetClient::DidMeaningfulLayout( | 448 void TestWebViewWidgetClient::DidMeaningfulLayout( |
| 450 WebMeaningfulLayout layout_type) { | 449 WebMeaningfulLayout layout_type) { |
| 451 test_web_view_client_.DidMeaningfulLayout(layout_type); | 450 test_web_view_client_.DidMeaningfulLayout(layout_type); |
| 452 } | 451 } |
| 453 | 452 |
| 454 } // namespace FrameTestHelpers | 453 } // namespace FrameTestHelpers |
| 455 } // namespace blink | 454 } // namespace blink |
| OLD | NEW |