| 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 "components/test_runner/web_view_test_client.h" | 5 #include "components/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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 92 |
| 93 void WebViewTestClient::showValidationMessage( | 93 void WebViewTestClient::showValidationMessage( |
| 94 const blink::WebRect& anchor_in_root_view, | 94 const blink::WebRect& anchor_in_root_view, |
| 95 const blink::WebString& main_message, | 95 const blink::WebString& main_message, |
| 96 blink::WebTextDirection main_message_hint, | 96 blink::WebTextDirection main_message_hint, |
| 97 const blink::WebString& sub_message, | 97 const blink::WebString& sub_message, |
| 98 blink::WebTextDirection sub_message_hint) { | 98 blink::WebTextDirection sub_message_hint) { |
| 99 if (test_runner()->is_web_platform_tests_mode()) | 99 if (test_runner()->is_web_platform_tests_mode()) |
| 100 return; | 100 return; |
| 101 | 101 |
| 102 base::string16 wrapped_main_text = main_message; | 102 base::string16 wrapped_main_text = main_message.utf16(); |
| 103 base::string16 wrapped_sub_text = sub_message; | 103 base::string16 wrapped_sub_text = sub_message.utf16(); |
| 104 | 104 |
| 105 if (main_message_hint == blink::WebTextDirectionLeftToRight) { | 105 if (main_message_hint == blink::WebTextDirectionLeftToRight) { |
| 106 wrapped_main_text = | 106 wrapped_main_text = |
| 107 base::i18n::GetDisplayStringInLTRDirectionality(wrapped_main_text); | 107 base::i18n::GetDisplayStringInLTRDirectionality(wrapped_main_text); |
| 108 } else if (main_message_hint == blink::WebTextDirectionRightToLeft && | 108 } else if (main_message_hint == blink::WebTextDirectionRightToLeft && |
| 109 !base::i18n::IsRTL()) { | 109 !base::i18n::IsRTL()) { |
| 110 base::i18n::WrapStringWithRTLFormatting(&wrapped_main_text); | 110 base::i18n::WrapStringWithRTLFormatting(&wrapped_main_text); |
| 111 } | 111 } |
| 112 | 112 |
| 113 if (!wrapped_sub_text.empty()) { | 113 if (!wrapped_sub_text.empty()) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 138 | 138 |
| 139 void WebViewTestClient::didFocus() { | 139 void WebViewTestClient::didFocus() { |
| 140 test_runner()->SetFocus(web_view_test_proxy_base_->web_view(), true); | 140 test_runner()->SetFocus(web_view_test_proxy_base_->web_view(), true); |
| 141 } | 141 } |
| 142 | 142 |
| 143 TestRunner* WebViewTestClient::test_runner() { | 143 TestRunner* WebViewTestClient::test_runner() { |
| 144 return web_view_test_proxy_base_->test_interfaces()->GetTestRunner(); | 144 return web_view_test_proxy_base_->test_interfaces()->GetTestRunner(); |
| 145 } | 145 } |
| 146 | 146 |
| 147 } // namespace test_runner | 147 } // namespace test_runner |
| OLD | NEW |