| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "content/shell/test_runner/web_view_test_client.h" | 5 #include "content/shell/test_runner/web_view_test_client.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 delegate()->PrintMessage(std::string("createView(") + | 65 delegate()->PrintMessage(std::string("createView(") + |
| 66 URLDescription(request.Url()) + ")\n"); | 66 URLDescription(request.Url()) + ")\n"); |
| 67 | 67 |
| 68 // The return value below is used to communicate to WebViewTestProxy whether | 68 // The return value below is used to communicate to WebViewTestProxy whether |
| 69 // it should forward the createView request to RenderViewImpl or not. The | 69 // it should forward the createView request to RenderViewImpl or not. The |
| 70 // somewhat ugly cast is used to do this while fitting into the existing | 70 // somewhat ugly cast is used to do this while fitting into the existing |
| 71 // WebViewClient interface. | 71 // WebViewClient interface. |
| 72 return reinterpret_cast<blink::WebView*>(0xdeadbeef); | 72 return reinterpret_cast<blink::WebView*>(0xdeadbeef); |
| 73 } | 73 } |
| 74 | 74 |
| 75 void WebViewTestClient::SetStatusText(const blink::WebString& text) { | |
| 76 if (!test_runner()->shouldDumpStatusCallbacks()) | |
| 77 return; | |
| 78 delegate()->PrintMessage( | |
| 79 std::string("UI DELEGATE STATUS CALLBACK: setStatusText:") + | |
| 80 text.Utf8().data() + "\n"); | |
| 81 } | |
| 82 | |
| 83 // Simulate a print by going into print mode and then exit straight away. | 75 // Simulate a print by going into print mode and then exit straight away. |
| 84 void WebViewTestClient::PrintPage(blink::WebLocalFrame* frame) { | 76 void WebViewTestClient::PrintPage(blink::WebLocalFrame* frame) { |
| 85 blink::WebSize page_size_in_pixels = frame->View()->Size(); | 77 blink::WebSize page_size_in_pixels = frame->View()->Size(); |
| 86 if (page_size_in_pixels.IsEmpty()) | 78 if (page_size_in_pixels.IsEmpty()) |
| 87 return; | 79 return; |
| 88 blink::WebPrintParams printParams(page_size_in_pixels); | 80 blink::WebPrintParams printParams(page_size_in_pixels); |
| 89 frame->PrintBegin(printParams); | 81 frame->PrintBegin(printParams); |
| 90 frame->PrintEnd(); | 82 frame->PrintEnd(); |
| 91 } | 83 } |
| 92 | 84 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 | 138 |
| 147 bool WebViewTestClient::CanHandleGestureEvent() { | 139 bool WebViewTestClient::CanHandleGestureEvent() { |
| 148 return true; | 140 return true; |
| 149 } | 141 } |
| 150 | 142 |
| 151 bool WebViewTestClient::CanUpdateLayout() { | 143 bool WebViewTestClient::CanUpdateLayout() { |
| 152 return true; | 144 return true; |
| 153 } | 145 } |
| 154 | 146 |
| 155 } // namespace test_runner | 147 } // namespace test_runner |
| OLD | NEW |