Chromium Code Reviews| Index: content/shell/renderer/test_runner/web_test_proxy.cc |
| diff --git a/content/shell/renderer/test_runner/web_test_proxy.cc b/content/shell/renderer/test_runner/web_test_proxy.cc |
| index 18086de32ee8f1eb6b975bb02ad542c083b682a3..0fd47fb96e9355f91e977f2ebd636431756eb151 100644 |
| --- a/content/shell/renderer/test_runner/web_test_proxy.cc |
| +++ b/content/shell/renderer/test_runner/web_test_proxy.cc |
| @@ -9,8 +9,10 @@ |
| #include "base/callback_helpers.h" |
| #include "base/command_line.h" |
| #include "base/debug/trace_event.h" |
| +#include "base/i18n/rtl.h" |
| #include "base/logging.h" |
| #include "base/strings/stringprintf.h" |
| +#include "base/strings/utf_string_conversions.h" |
| #include "content/public/common/content_switches.h" |
| #include "content/shell/renderer/test_runner/TestPlugin.h" |
| #include "content/shell/renderer/test_runner/WebTestDelegate.h" |
| @@ -380,12 +382,32 @@ bool WebTestProxyBase::RunFileChooser( |
| void WebTestProxyBase::ShowValidationMessage( |
| const blink::WebRect& anchor_in_root_view, |
| const blink::WebString& message, |
| + blink::WebTextDirection message_dir, |
| const blink::WebString& sub_message, |
| - blink::WebTextDirection hint) { |
| + blink::WebTextDirection sub_message_dir) { |
| + base::string16 wrapped_main_text = message; |
| + base::string16 wrapped_sub_text = sub_message; |
| + |
| + if (message_dir == blink::WebTextDirectionLeftToRight) { |
|
jamesr
2014/08/29 17:21:50
this looks very repetitive. is there any way to sh
|
| + wrapped_main_text = |
| + base::i18n::GetDisplayStringInLTRDirectionality(wrapped_main_text); |
| + } else if (message_dir == blink::WebTextDirectionRightToLeft) { |
| + base::i18n::WrapStringWithRTLFormatting(&wrapped_main_text); |
| + } |
| + |
| + if (!wrapped_sub_text.empty()) { |
| + if (sub_message_dir == blink::WebTextDirectionLeftToRight) { |
| + wrapped_sub_text = |
| + base::i18n::GetDisplayStringInLTRDirectionality(wrapped_sub_text); |
| + } else if (sub_message_dir == blink::WebTextDirectionRightToLeft) { |
| + base::i18n::WrapStringWithRTLFormatting(&wrapped_sub_text); |
| + } |
| + } |
| delegate_->printMessage( |
| - std::string("ValidationMessageClient: main-message=") + |
| - std::string(message.utf8()) + " sub-message=" + |
| - std::string(sub_message.utf8()) + "\n"); |
| + "ValidationMessageClient: main-message=" + |
| + base::UTF16ToUTF8(wrapped_main_text) + |
| + " sub-message=" + |
| + base::UTF16ToUTF8(wrapped_sub_text) + "\n"); |
| } |
| std::string WebTestProxyBase::CaptureTree(bool debug_render_tree) { |