summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjochen <jochen@chromium.org>2015-07-02 08:15:01 -0700
committerCommit bot <commit-bot@chromium.org>2015-07-02 15:15:38 +0000
commitea29d8adcde1950fc9728f48c81600c03d6a0f3f (patch)
tree8f5619f8923d84e87cb6cf131f5f04ee10ce5149
parent5bdee9ce280c64269fefea901c08f98d90adb232 (diff)
downloadchromium_src-ea29d8adcde1950fc9728f48c81600c03d6a0f3f.zip
chromium_src-ea29d8adcde1950fc9728f48c81600c03d6a0f3f.tar.gz
chromium_src-ea29d8adcde1950fc9728f48c81600c03d6a0f3f.tar.bz2
Remove remaining layering violations from test runner
The proxies assumed that their base classes are actually RenderView and RenderFrame which they are in general not BUG=478250 R=nasko@chromium.org Review URL: https://codereview.chromium.org/1220163004 Cr-Commit-Position: refs/heads/master@{#337223}
-rw-r--r--components/test_runner/BUILD.gn3
-rw-r--r--components/test_runner/test_runner.gyp1
-rw-r--r--components/test_runner/web_frame_test_proxy.h3
-rw-r--r--components/test_runner/web_test_proxy.cc32
-rw-r--r--components/test_runner/web_test_proxy.h19
5 files changed, 38 insertions, 20 deletions
diff --git a/components/test_runner/BUILD.gn b/components/test_runner/BUILD.gn
index 0471b5f..30d7fb2 100644
--- a/components/test_runner/BUILD.gn
+++ b/components/test_runner/BUILD.gn
@@ -87,7 +87,8 @@ component("test_runner") {
deps = [
":resources",
- "//base",
+ "//base:base",
+ "//base:i18n",
"//cc",
"//gin",
"//gpu",
diff --git a/components/test_runner/test_runner.gyp b/components/test_runner/test_runner.gyp
index 0a06f74..8c9eedf 100644
--- a/components/test_runner/test_runner.gyp
+++ b/components/test_runner/test_runner.gyp
@@ -20,6 +20,7 @@
'dependencies': [
'resources',
'../../base/base.gyp:base',
+ '../../base/base.gyp:base_i18n',
'../../cc/cc.gyp:cc',
'../../gin/gin.gyp:gin',
'../../gpu/gpu.gyp:gpu',
diff --git a/components/test_runner/web_frame_test_proxy.h b/components/test_runner/web_frame_test_proxy.h
index cc9cf94..8783219 100644
--- a/components/test_runner/web_frame_test_proxy.h
+++ b/components/test_runner/web_frame_test_proxy.h
@@ -175,8 +175,7 @@ class WebFrameTestProxy : public Base {
virtual void showContextMenu(
const blink::WebContextMenuData& context_menu_data) {
- base_proxy_->ShowContextMenu(Base::GetWebFrame(),
- context_menu_data);
+ base_proxy_->ShowContextMenu(context_menu_data);
Base::showContextMenu(context_menu_data);
}
diff --git a/components/test_runner/web_test_proxy.cc b/components/test_runner/web_test_proxy.cc
index 7bc243c..4b2b43a 100644
--- a/components/test_runner/web_test_proxy.cc
+++ b/components/test_runner/web_test_proxy.cc
@@ -8,6 +8,7 @@
#include "base/callback_helpers.h"
#include "base/command_line.h"
+#include "base/i18n/rtl.h"
#include "base/logging.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
@@ -450,11 +451,33 @@ bool WebTestProxyBase::RunFileChooser(
}
void WebTestProxyBase::ShowValidationMessage(
- const base::string16& message,
- const base::string16& sub_message) {
+ const blink::WebString& main_message,
+ blink::WebTextDirection main_message_hint,
+ const blink::WebString& sub_message,
+ blink::WebTextDirection sub_message_hint) {
+ base::string16 wrapped_main_text = main_message;
+ base::string16 wrapped_sub_text = sub_message;
+
+ if (main_message_hint == blink::WebTextDirectionLeftToRight) {
+ wrapped_main_text =
+ base::i18n::GetDisplayStringInLTRDirectionality(wrapped_main_text);
+ } else if (main_message_hint == blink::WebTextDirectionRightToLeft &&
+ !base::i18n::IsRTL()) {
+ base::i18n::WrapStringWithRTLFormatting(&wrapped_main_text);
+ }
+
+ if (!wrapped_sub_text.empty()) {
+ if (sub_message_hint == blink::WebTextDirectionLeftToRight) {
+ wrapped_sub_text =
+ base::i18n::GetDisplayStringInLTRDirectionality(wrapped_sub_text);
+ } else if (sub_message_hint == blink::WebTextDirectionRightToLeft) {
+ base::i18n::WrapStringWithRTLFormatting(&wrapped_sub_text);
+ }
+ }
delegate_->PrintMessage("ValidationMessageClient: main-message=" +
- base::UTF16ToUTF8(message) + " sub-message=" +
- base::UTF16ToUTF8(sub_message) + "\n");
+ base::UTF16ToUTF8(wrapped_main_text) +
+ " sub-message=" +
+ base::UTF16ToUTF8(wrapped_sub_text) + "\n");
}
std::string WebTestProxyBase::CaptureTree(
@@ -946,7 +969,6 @@ void WebTestProxyBase::DidStopLoading() {
}
void WebTestProxyBase::ShowContextMenu(
- blink::WebLocalFrame* frame,
const blink::WebContextMenuData& context_menu_data) {
test_interfaces_->GetEventSender()->SetContextMenuData(context_menu_data);
}
diff --git a/components/test_runner/web_test_proxy.h b/components/test_runner/web_test_proxy.h
index fd5c39c..18dd7c9 100644
--- a/components/test_runner/web_test_proxy.h
+++ b/components/test_runner/web_test_proxy.h
@@ -106,8 +106,10 @@ class TEST_RUNNER_EXPORT WebTestProxyBase {
const blink::WebVector<blink::WebColorSuggestion>& suggestions);
bool RunFileChooser(const blink::WebFileChooserParams& params,
blink::WebFileChooserCompletion* completion);
- void ShowValidationMessage(const base::string16& message,
- const base::string16& sub_message);
+ void ShowValidationMessage(const blink::WebString& main_message,
+ blink::WebTextDirection main_message_hint,
+ const blink::WebString& sub_message,
+ blink::WebTextDirection sub_message_hint);
void HideValidationMessage();
void MoveValidationMessage(const blink::WebRect& anchor_in_root_view);
@@ -164,8 +166,7 @@ class TEST_RUNNER_EXPORT WebTestProxyBase {
const blink::WebPluginParams& params);
void SetStatusText(const blink::WebString& text);
void DidStopLoading();
- void ShowContextMenu(blink::WebLocalFrame* frame,
- const blink::WebContextMenuData& data);
+ void ShowContextMenu(const blink::WebContextMenuData& data);
blink::WebUserMediaClient* GetUserMediaClient();
void PrintPage(blink::WebLocalFrame* frame);
blink::WebSpeechRecognizer* GetSpeechRecognizer();
@@ -384,14 +385,8 @@ class WebTestProxy : public Base, public WebTestProxyBase {
blink::WebTextDirection main_message_hint,
const blink::WebString& sub_message,
blink::WebTextDirection sub_message_hint) {
- base::string16 wrapped_main_text = main_message;
- base::string16 wrapped_sub_text = sub_message;
-
- Base::SetValidationMessageDirection(&wrapped_main_text, main_message_hint,
- &wrapped_sub_text, sub_message_hint);
-
- WebTestProxyBase::ShowValidationMessage(
- wrapped_main_text, wrapped_sub_text);
+ WebTestProxyBase::ShowValidationMessage(main_message, main_message_hint,
+ sub_message, sub_message_hint);
}
virtual void postSpellCheckEvent(const blink::WebString& event_name) {
WebTestProxyBase::PostSpellCheckEvent(event_name);