| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/strings/stringprintf.h" | 5 #include "base/strings/stringprintf.h" |
| 6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
| 7 #include "chrome/test/base/chrome_render_view_test.h" | 7 #include "chrome/test/base/chrome_render_view_test.h" |
| 8 #include "components/translate/core/common/translate_errors.h" | 8 #include "components/translate/core/common/translate_errors.h" |
| 9 #include "grit/component_resources.h" | 9 #include "grit/component_resources.h" |
| 10 #include "third_party/WebKit/public/web/WebFrame.h" | 10 #include "third_party/WebKit/public/web/WebFrame.h" |
| 11 #include "third_party/WebKit/public/web/WebScriptSource.h" | 11 #include "third_party/WebKit/public/web/WebScriptSource.h" |
| 12 #include "ui/base/resource/resource_bundle.h" | 12 #include "ui/base/resource/resource_bundle.h" |
| 13 #include "v8/include/v8.h" |
| 13 | 14 |
| 14 using blink::WebFrame; | 15 using blink::WebFrame; |
| 15 using blink::WebScriptSource; | 16 using blink::WebScriptSource; |
| 16 | 17 |
| 17 namespace { | 18 namespace { |
| 18 | 19 |
| 19 // JavaScript code to set runtime test flags. | 20 // JavaScript code to set runtime test flags. |
| 20 const char kThrowInitializationError[] = "throwInitializationError = true"; | 21 const char kThrowInitializationError[] = "throwInitializationError = true"; |
| 21 const char kThrowUnexpectedScriptError[] = "throwUnexpectedScriptError = true"; | 22 const char kThrowUnexpectedScriptError[] = "throwUnexpectedScriptError = true"; |
| 22 const char kCallbackReturnBooleanError[] = "callbackReturnBooleanError = true"; | 23 const char kCallbackReturnBooleanError[] = "callbackReturnBooleanError = true"; |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 EXPECT_FALSE(GetError()); | 231 EXPECT_FALSE(GetError()); |
| 231 EXPECT_EQ(TranslateErrors::NONE, GetErrorCode()); | 232 EXPECT_EQ(TranslateErrors::NONE, GetErrorCode()); |
| 232 | 233 |
| 233 ExecuteScript(kTranslate); | 234 ExecuteScript(kTranslate); |
| 234 | 235 |
| 235 EXPECT_TRUE(GetError()); | 236 EXPECT_TRUE(GetError()); |
| 236 EXPECT_EQ(TranslateErrors::UNSUPPORTED_LANGUAGE, GetErrorCode()); | 237 EXPECT_EQ(TranslateErrors::UNSUPPORTED_LANGUAGE, GetErrorCode()); |
| 237 } | 238 } |
| 238 | 239 |
| 239 // TODO(toyoshim): Add test for onLoadJavaScript. | 240 // TODO(toyoshim): Add test for onLoadJavaScript. |
| OLD | NEW |