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

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

Issue 19579005: Move ReadFileToString to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 | « chrome/test/base/module_system_test.cc ('k') | chrome/test/base/web_ui_browsertest.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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 user_libraries_iterator != user_libraries_.end(); 64 user_libraries_iterator != user_libraries_.end();
65 ++user_libraries_iterator) { 65 ++user_libraries_iterator) {
66 std::string library_content; 66 std::string library_content;
67 base::FilePath library_file(*user_libraries_iterator); 67 base::FilePath library_file(*user_libraries_iterator);
68 if (!user_libraries_iterator->IsAbsolute()) { 68 if (!user_libraries_iterator->IsAbsolute()) {
69 base::FilePath gen_file = gen_test_data_directory.Append(library_file); 69 base::FilePath gen_file = gen_test_data_directory.Append(library_file);
70 library_file = base::PathExists(gen_file) ? gen_file : 70 library_file = base::PathExists(gen_file) ? gen_file :
71 test_data_directory.Append(*user_libraries_iterator); 71 test_data_directory.Append(*user_libraries_iterator);
72 } 72 }
73 library_file = base::MakeAbsoluteFilePath(library_file); 73 library_file = base::MakeAbsoluteFilePath(library_file);
74 if (!file_util::ReadFileToString(library_file, &library_content)) { 74 if (!base::ReadFileToString(library_file, &library_content)) {
75 ADD_FAILURE() << library_file.value(); 75 ADD_FAILURE() << library_file.value();
76 return false; 76 return false;
77 } 77 }
78 ExecuteScriptInContext(library_content, library_file.MaybeAsASCII()); 78 ExecuteScriptInContext(library_content, library_file.MaybeAsASCII());
79 if (::testing::Test::HasFatalFailure()) 79 if (::testing::Test::HasFatalFailure())
80 return false; 80 return false;
81 } 81 }
82 return true; 82 return true;
83 } 83 }
84 84
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 v8::Handle<v8::Array> testResult(args[1].As<v8::Array>()); 277 v8::Handle<v8::Array> testResult(args[1].As<v8::Array>());
278 EXPECT_EQ(2U, testResult->Length()); 278 EXPECT_EQ(2U, testResult->Length());
279 if (::testing::Test::HasNonfatalFailure()) 279 if (::testing::Test::HasNonfatalFailure())
280 return; 280 return;
281 testResult_ok = testResult->Get(0)->BooleanValue(); 281 testResult_ok = testResult->Get(0)->BooleanValue();
282 if (!testResult_ok) { 282 if (!testResult_ok) {
283 v8::String::Utf8Value message(testResult->Get(1)); 283 v8::String::Utf8Value message(testResult->Get(1));
284 LOG(ERROR) << *message; 284 LOG(ERROR) << *message;
285 } 285 }
286 } 286 }
OLDNEW
« no previous file with comments | « chrome/test/base/module_system_test.cc ('k') | chrome/test/base/web_ui_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698