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

Side by Side Diff: chrome/renderer/translate/translate_script_browsertest.cc

Issue 679273002: Standardize usage of virtual/override/final specifiers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 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/components_resources.h" 9 #include "grit/components_resources.h"
10 #include "third_party/WebKit/public/web/WebLocalFrame.h" 10 #include "third_party/WebKit/public/web/WebLocalFrame.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 95
96 double GetErrorCode() { 96 double GetErrorCode() {
97 return ExecuteScriptAndGetNumberResult(kErrorCode); 97 return ExecuteScriptAndGetNumberResult(kErrorCode);
98 } 98 }
99 99
100 bool IsLibReady() { 100 bool IsLibReady() {
101 return ExecuteScriptAndGetBoolResult(kLibReady); 101 return ExecuteScriptAndGetBoolResult(kLibReady);
102 } 102 }
103 103
104 private: 104 private:
105 virtual void SetUp() override { 105 void SetUp() override { ChromeRenderViewTest::SetUp(); }
106 ChromeRenderViewTest::SetUp();
107 }
108 106
109 virtual void TearDown() override { 107 void TearDown() override { ChromeRenderViewTest::TearDown(); }
110 ChromeRenderViewTest::TearDown();
111 }
112 108
113 double ExecuteScriptAndGetNumberResult(const std::string& script) { 109 double ExecuteScriptAndGetNumberResult(const std::string& script) {
114 WebScriptSource source = WebScriptSource(base::ASCIIToUTF16(script)); 110 WebScriptSource source = WebScriptSource(base::ASCIIToUTF16(script));
115 v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); 111 v8::HandleScope handle_scope(v8::Isolate::GetCurrent());
116 v8::Handle<v8::Value> result = 112 v8::Handle<v8::Value> result =
117 GetMainFrame()->executeScriptAndReturnValue(source); 113 GetMainFrame()->executeScriptAndReturnValue(source);
118 if (result.IsEmpty() || !result->IsNumber()) { 114 if (result.IsEmpty() || !result->IsNumber()) {
119 NOTREACHED(); 115 NOTREACHED();
120 // TODO(toyoshim): Return NaN here and the real implementation in 116 // TODO(toyoshim): Return NaN here and the real implementation in
121 // TranslateHelper::ExecuteScriptAndGetDoubleResult(). 117 // TranslateHelper::ExecuteScriptAndGetDoubleResult().
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 EXPECT_FALSE(GetError()); 227 EXPECT_FALSE(GetError());
232 EXPECT_EQ(translate::TranslateErrors::NONE, GetErrorCode()); 228 EXPECT_EQ(translate::TranslateErrors::NONE, GetErrorCode());
233 229
234 ExecuteScript(kTranslate); 230 ExecuteScript(kTranslate);
235 231
236 EXPECT_TRUE(GetError()); 232 EXPECT_TRUE(GetError());
237 EXPECT_EQ(translate::TranslateErrors::UNSUPPORTED_LANGUAGE, GetErrorCode()); 233 EXPECT_EQ(translate::TranslateErrors::UNSUPPORTED_LANGUAGE, GetErrorCode());
238 } 234 }
239 235
240 // TODO(toyoshim): Add test for onLoadJavaScript. 236 // TODO(toyoshim): Add test for onLoadJavaScript.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698