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

Side by Side Diff: chrome/test/base/v8_unit_test.cc

Issue 122073003: Track v8 API changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | content/public/test/render_view_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/test/base/v8_unit_test.h" 5 #include "chrome/test/base/v8_unit_test.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/strings/string_piece.h" 10 #include "base/strings/string_piece.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &testApiPath)); 160 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &testApiPath));
161 testApiPath = testApiPath.AppendASCII("webui"); 161 testApiPath = testApiPath.AppendASCII("webui");
162 testApiPath = testApiPath.AppendASCII("test_api.js"); 162 testApiPath = testApiPath.AppendASCII("test_api.js");
163 AddLibrary(testApiPath); 163 AddLibrary(testApiPath);
164 } 164 }
165 165
166 void V8UnitTest::SetUp() { 166 void V8UnitTest::SetUp() {
167 v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate_); 167 v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate_);
168 v8::Handle<v8::String> logString = v8::String::NewFromUtf8(isolate_, "log"); 168 v8::Handle<v8::String> logString = v8::String::NewFromUtf8(isolate_, "log");
169 v8::Handle<v8::FunctionTemplate> logFunction = 169 v8::Handle<v8::FunctionTemplate> logFunction =
170 v8::FunctionTemplate::New(&V8UnitTest::Log); 170 v8::FunctionTemplate::New(isolate_, &V8UnitTest::Log);
171 global->Set(logString, logFunction); 171 global->Set(logString, logFunction);
172 172
173 // Set up chrome object for chrome.send(). 173 // Set up chrome object for chrome.send().
174 v8::Handle<v8::ObjectTemplate> chrome = v8::ObjectTemplate::New(isolate_); 174 v8::Handle<v8::ObjectTemplate> chrome = v8::ObjectTemplate::New(isolate_);
175 global->Set(v8::String::NewFromUtf8(isolate_, "chrome"), chrome); 175 global->Set(v8::String::NewFromUtf8(isolate_, "chrome"), chrome);
176 chrome->Set(v8::String::NewFromUtf8(isolate_, "send"), 176 chrome->Set(v8::String::NewFromUtf8(isolate_, "send"),
177 v8::FunctionTemplate::New(isolate_, &V8UnitTest::ChromeSend)); 177 v8::FunctionTemplate::New(isolate_, &V8UnitTest::ChromeSend));
178 178
179 // Set up console object for console.log(), etc. 179 // Set up console object for console.log(), etc.
180 v8::Handle<v8::ObjectTemplate> console = v8::ObjectTemplate::New(isolate_); 180 v8::Handle<v8::ObjectTemplate> console = v8::ObjectTemplate::New(isolate_);
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 v8::Handle<v8::Array> testResult(args[1].As<v8::Array>()); 298 v8::Handle<v8::Array> testResult(args[1].As<v8::Array>());
299 EXPECT_EQ(2U, testResult->Length()); 299 EXPECT_EQ(2U, testResult->Length());
300 if (::testing::Test::HasNonfatalFailure()) 300 if (::testing::Test::HasNonfatalFailure())
301 return; 301 return;
302 testResult_ok = testResult->Get(0)->BooleanValue(); 302 testResult_ok = testResult->Get(0)->BooleanValue();
303 if (!testResult_ok) { 303 if (!testResult_ok) {
304 v8::String::Utf8Value message(testResult->Get(1)); 304 v8::String::Utf8Value message(testResult->Get(1));
305 LOG(ERROR) << *message; 305 LOG(ERROR) << *message;
306 } 306 }
307 } 307 }
OLDNEW
« no previous file with comments | « no previous file | content/public/test/render_view_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698