Chromium Code Reviews| OLD | NEW |
|---|---|
| 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" |
| 12 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
| 13 #include "content/shell/renderer/test_runner/MockWebSpeechRecognizer.h" | 14 #include "content/shell/renderer/test_runner/MockWebSpeechRecognizer.h" |
| 14 #include "content/shell/renderer/test_runner/SpellCheckClient.h" | 15 #include "content/shell/renderer/test_runner/SpellCheckClient.h" |
| 15 #include "content/shell/renderer/test_runner/TestCommon.h" | 16 #include "content/shell/renderer/test_runner/TestCommon.h" |
| 16 #include "content/shell/renderer/test_runner/TestInterfaces.h" | 17 #include "content/shell/renderer/test_runner/TestInterfaces.h" |
| 17 #include "content/shell/renderer/test_runner/TestPlugin.h" | 18 #include "content/shell/renderer/test_runner/TestPlugin.h" |
| 18 #include "content/shell/renderer/test_runner/WebTestDelegate.h" | 19 #include "content/shell/renderer/test_runner/WebTestDelegate.h" |
| 19 #include "content/shell/renderer/test_runner/WebTestInterfaces.h" | 20 #include "content/shell/renderer/test_runner/WebTestInterfaces.h" |
| 20 #include "content/shell/renderer/test_runner/accessibility_controller.h" | 21 #include "content/shell/renderer/test_runner/accessibility_controller.h" |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 367 const blink::WebFileChooserParams& params, | 368 const blink::WebFileChooserParams& params, |
| 368 blink::WebFileChooserCompletion* completion) { | 369 blink::WebFileChooserCompletion* completion) { |
| 369 delegate_->printMessage("Mock: Opening a file chooser.\n"); | 370 delegate_->printMessage("Mock: Opening a file chooser.\n"); |
| 370 // FIXME: Add ability to set file names to a file upload control. | 371 // FIXME: Add ability to set file names to a file upload control. |
| 371 return false; | 372 return false; |
| 372 } | 373 } |
| 373 | 374 |
| 374 void WebTestProxyBase::ShowValidationMessage( | 375 void WebTestProxyBase::ShowValidationMessage( |
| 375 const blink::WebRect& anchor_in_root_view, | 376 const blink::WebRect& anchor_in_root_view, |
| 376 const blink::WebString& message, | 377 const blink::WebString& message, |
| 378 blink::WebTextDirection message_dir, | |
| 377 const blink::WebString& sub_message, | 379 const blink::WebString& sub_message, |
| 378 blink::WebTextDirection hint) { | 380 blink::WebTextDirection sub_message_dir) { |
| 381 base::string16 wrapped_main_text = message; | |
| 382 base::string16 wrapped_sub_text = sub_message; | |
| 383 | |
| 384 if (message_dir == blink::WebTextDirectionLeftToRight) { | |
| 385 wrapped_main_text = | |
| 386 base::i18n::GetDisplayStringInLTRDirectionality(wrapped_main_text); | |
|
jam
2014/08/21 17:32:52
more indent
Habib Virji
2014/08/26 08:55:44
Done.
| |
| 387 } else if (message_dir == blink::WebTextDirectionRightToLeft) { | |
| 388 base::i18n::WrapStringWithRTLFormatting(&wrapped_main_text); | |
| 389 } | |
| 390 | |
| 391 if (!wrapped_sub_text.empty()) { | |
| 392 if (sub_message_dir == blink::WebTextDirectionLeftToRight) { | |
| 393 wrapped_sub_text = | |
| 394 base::i18n::GetDisplayStringInLTRDirectionality(wrapped_sub_text); | |
|
jam
2014/08/21 17:32:52
ditto
Habib Virji
2014/08/26 08:55:44
Done.
| |
| 395 } else if (sub_message_dir == blink::WebTextDirectionRightToLeft) { | |
| 396 base::i18n::WrapStringWithRTLFormatting(&wrapped_sub_text); | |
| 397 } | |
| 398 } | |
| 379 delegate_->printMessage( | 399 delegate_->printMessage( |
| 380 std::string("ValidationMessageClient: main-message=") + | 400 "ValidationMessageClient: main-message=" + |
| 381 std::string(message.utf8()) + " sub-message=" + | 401 base::UTF16ToUTF8(wrapped_main_text) + |
| 382 std::string(sub_message.utf8()) + "\n"); | 402 " sub-message=" + |
| 403 base::UTF16ToUTF8(wrapped_sub_text) + "\n"); | |
| 383 } | 404 } |
| 384 | 405 |
| 385 std::string WebTestProxyBase::CaptureTree(bool debug_render_tree) { | 406 std::string WebTestProxyBase::CaptureTree(bool debug_render_tree) { |
| 386 bool should_dump_custom_text = | 407 bool should_dump_custom_text = |
| 387 test_interfaces_->testRunner()->shouldDumpAsCustomText(); | 408 test_interfaces_->testRunner()->shouldDumpAsCustomText(); |
| 388 bool should_dump_as_text = test_interfaces_->testRunner()->shouldDumpAsText(); | 409 bool should_dump_as_text = test_interfaces_->testRunner()->shouldDumpAsText(); |
| 389 bool should_dump_as_markup = | 410 bool should_dump_as_markup = |
| 390 test_interfaces_->testRunner()->shouldDumpAsMarkup(); | 411 test_interfaces_->testRunner()->shouldDumpAsMarkup(); |
| 391 bool should_dump_as_printed = test_interfaces_->testRunner()->isPrinting(); | 412 bool should_dump_as_printed = test_interfaces_->testRunner()->isPrinting(); |
| 392 blink::WebFrame* frame = GetWebView()->mainFrame(); | 413 blink::WebFrame* frame = GetWebView()->mainFrame(); |
| (...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1257 if (!push_client_.get()) | 1278 if (!push_client_.get()) |
| 1258 push_client_.reset(new MockWebPushClient); | 1279 push_client_.reset(new MockWebPushClient); |
| 1259 return push_client_.get(); | 1280 return push_client_.get(); |
| 1260 } | 1281 } |
| 1261 | 1282 |
| 1262 blink::WebPushClient* WebTestProxyBase::GetWebPushClient() { | 1283 blink::WebPushClient* WebTestProxyBase::GetWebPushClient() { |
| 1263 return GetPushClientMock(); | 1284 return GetPushClientMock(); |
| 1264 } | 1285 } |
| 1265 | 1286 |
| 1266 } // namespace content | 1287 } // namespace content |
| OLD | NEW |