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

Unified Diff: content/shell/renderer/test_runner/web_test_proxy.cc

Issue 391923006: Extra parameter to pass sub-message direction for validation message (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Unit test updated to reflect direction changes Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
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 270f990ec7876cfd7b79f9d226cb383ef331d8a5..ce511970b84dc47633a3e8f578f0af8011351fbf 100644
--- a/content/shell/renderer/test_runner/web_test_proxy.cc
+++ b/content/shell/renderer/test_runner/web_test_proxy.cc
@@ -8,7 +8,9 @@
#include "base/callback_helpers.h"
#include "base/debug/trace_event.h"
+#include "base/i18n/rtl.h"
#include "base/logging.h"
+#include "base/strings/utf_string_conversions.h"
#include "content/shell/renderer/test_runner/MockColorChooser.h"
#include "content/shell/renderer/test_runner/MockWebSpeechRecognizer.h"
#include "content/shell/renderer/test_runner/SpellCheckClient.h"
@@ -377,12 +379,30 @@ 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)
jam 2014/08/18 17:55:51 nit: need brace brackets
Habib Virji 2014/08/20 09:15:55 Done.
+ 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) {
« content/renderer/render_view_impl.cc ('K') | « content/shell/renderer/test_runner/web_test_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698