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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/renderer/test_runner/web_test_proxy.h" 5 #include "content/shell/renderer/test_runner/web_test_proxy.h"
6 6
7 #include <cctype> 7 #include <cctype>
8 8
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
11 #include "base/i18n/rtl.h"
11 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/strings/utf_string_conversions.h"
12 #include "content/shell/renderer/test_runner/MockColorChooser.h" 14 #include "content/shell/renderer/test_runner/MockColorChooser.h"
13 #include "content/shell/renderer/test_runner/MockWebSpeechRecognizer.h" 15 #include "content/shell/renderer/test_runner/MockWebSpeechRecognizer.h"
14 #include "content/shell/renderer/test_runner/SpellCheckClient.h" 16 #include "content/shell/renderer/test_runner/SpellCheckClient.h"
15 #include "content/shell/renderer/test_runner/TestCommon.h" 17 #include "content/shell/renderer/test_runner/TestCommon.h"
16 #include "content/shell/renderer/test_runner/TestInterfaces.h" 18 #include "content/shell/renderer/test_runner/TestInterfaces.h"
17 #include "content/shell/renderer/test_runner/TestPlugin.h" 19 #include "content/shell/renderer/test_runner/TestPlugin.h"
18 #include "content/shell/renderer/test_runner/WebTestDelegate.h" 20 #include "content/shell/renderer/test_runner/WebTestDelegate.h"
19 #include "content/shell/renderer/test_runner/WebTestInterfaces.h" 21 #include "content/shell/renderer/test_runner/WebTestInterfaces.h"
20 #include "content/shell/renderer/test_runner/accessibility_controller.h" 22 #include "content/shell/renderer/test_runner/accessibility_controller.h"
21 #include "content/shell/renderer/test_runner/event_sender.h" 23 #include "content/shell/renderer/test_runner/event_sender.h"
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 const blink::WebFileChooserParams& params, 372 const blink::WebFileChooserParams& params,
371 blink::WebFileChooserCompletion* completion) { 373 blink::WebFileChooserCompletion* completion) {
372 delegate_->printMessage("Mock: Opening a file chooser.\n"); 374 delegate_->printMessage("Mock: Opening a file chooser.\n");
373 // FIXME: Add ability to set file names to a file upload control. 375 // FIXME: Add ability to set file names to a file upload control.
374 return false; 376 return false;
375 } 377 }
376 378
377 void WebTestProxyBase::ShowValidationMessage( 379 void WebTestProxyBase::ShowValidationMessage(
378 const blink::WebRect& anchor_in_root_view, 380 const blink::WebRect& anchor_in_root_view,
379 const blink::WebString& message, 381 const blink::WebString& message,
382 blink::WebTextDirection message_dir,
380 const blink::WebString& sub_message, 383 const blink::WebString& sub_message,
381 blink::WebTextDirection hint) { 384 blink::WebTextDirection sub_message_dir) {
385 base::string16 wrapped_main_text = message;
386 base::string16 wrapped_sub_text = sub_message;
387
388 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.
389 wrapped_main_text =
390 base::i18n::GetDisplayStringInLTRDirectionality(wrapped_main_text);
391 else if (message_dir == blink::WebTextDirectionRightToLeft)
392 base::i18n::WrapStringWithRTLFormatting(&wrapped_main_text);
393
394 if (!wrapped_sub_text.empty()) {
395 if (sub_message_dir == blink::WebTextDirectionLeftToRight)
396 wrapped_sub_text =
397 base::i18n::GetDisplayStringInLTRDirectionality(wrapped_sub_text);
398 else if (sub_message_dir == blink::WebTextDirectionRightToLeft)
399 base::i18n::WrapStringWithRTLFormatting(&wrapped_sub_text);
400 }
382 delegate_->printMessage( 401 delegate_->printMessage(
383 std::string("ValidationMessageClient: main-message=") + 402 "ValidationMessageClient: main-message=" +
384 std::string(message.utf8()) + " sub-message=" + 403 base::UTF16ToUTF8(wrapped_main_text) +
385 std::string(sub_message.utf8()) + "\n"); 404 " sub-message=" +
405 base::UTF16ToUTF8(wrapped_sub_text) + "\n");
386 } 406 }
387 407
388 std::string WebTestProxyBase::CaptureTree(bool debug_render_tree) { 408 std::string WebTestProxyBase::CaptureTree(bool debug_render_tree) {
389 bool should_dump_custom_text = 409 bool should_dump_custom_text =
390 test_interfaces_->testRunner()->shouldDumpAsCustomText(); 410 test_interfaces_->testRunner()->shouldDumpAsCustomText();
391 bool should_dump_as_text = test_interfaces_->testRunner()->shouldDumpAsText(); 411 bool should_dump_as_text = test_interfaces_->testRunner()->shouldDumpAsText();
392 bool should_dump_as_markup = 412 bool should_dump_as_markup =
393 test_interfaces_->testRunner()->shouldDumpAsMarkup(); 413 test_interfaces_->testRunner()->shouldDumpAsMarkup();
394 bool should_dump_as_printed = test_interfaces_->testRunner()->isPrinting(); 414 bool should_dump_as_printed = test_interfaces_->testRunner()->isPrinting();
395 blink::WebFrame* frame = GetWebView()->mainFrame(); 415 blink::WebFrame* frame = GetWebView()->mainFrame();
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after
1269 if (!push_client_.get()) 1289 if (!push_client_.get())
1270 push_client_.reset(new MockWebPushClient); 1290 push_client_.reset(new MockWebPushClient);
1271 return push_client_.get(); 1291 return push_client_.get();
1272 } 1292 }
1273 1293
1274 blink::WebPushClient* WebTestProxyBase::GetWebPushClient() { 1294 blink::WebPushClient* WebTestProxyBase::GetWebPushClient() {
1275 return GetPushClientMock(); 1295 return GetPushClientMock();
1276 } 1296 }
1277 1297
1278 } // namespace content 1298 } // namespace content
OLDNEW
« 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