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

Side by Side Diff: chrome/common/extensions/api/storage/storage_schema_manifest_handler_unittest.cc

Issue 184563006: Move WriteFile and WriteFileDescriptor from file_util to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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
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 "chrome/common/extensions/api/storage/storage_schema_manifest_handler.h " 5 #include "chrome/common/extensions/api/storage/storage_schema_manifest_handler.h "
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 28 matching lines...) Expand all
39 std::string error; 39 std::string error;
40 scoped_refptr<Extension> extension = Extension::Create( 40 scoped_refptr<Extension> extension = Extension::Create(
41 temp_dir_.path(), Manifest::UNPACKED, manifest_, 41 temp_dir_.path(), Manifest::UNPACKED, manifest_,
42 Extension::NO_FLAGS, "", &error); 42 Extension::NO_FLAGS, "", &error);
43 if (!extension.get()) 43 if (!extension.get())
44 return NULL; 44 return NULL;
45 base::FilePath schema_path = temp_dir_.path().AppendASCII("schema.json"); 45 base::FilePath schema_path = temp_dir_.path().AppendASCII("schema.json");
46 if (schema.empty()) { 46 if (schema.empty()) {
47 base::DeleteFile(schema_path, false); 47 base::DeleteFile(schema_path, false);
48 } else { 48 } else {
49 if (file_util::WriteFile(schema_path, schema.data(), schema.size()) != 49 if (base::WriteFile(schema_path, schema.data(), schema.size()) !=
50 static_cast<int>(schema.size())) { 50 static_cast<int>(schema.size())) {
51 return NULL; 51 return NULL;
52 } 52 }
53 } 53 }
54 return extension; 54 return extension;
55 } 55 }
56 56
57 testing::AssertionResult Validates(const std::string& schema) { 57 testing::AssertionResult Validates(const std::string& schema) {
58 scoped_refptr<Extension> extension = CreateExtension(schema); 58 scoped_refptr<Extension> extension = CreateExtension(schema);
59 if (!extension.get()) 59 if (!extension.get())
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 141
142 // All good now. 142 // All good now.
143 EXPECT_TRUE(Validates( 143 EXPECT_TRUE(Validates(
144 "{" 144 "{"
145 " \"$schema\": \"http://json-schema.org/draft-03/schema#\"," 145 " \"$schema\": \"http://json-schema.org/draft-03/schema#\","
146 " \"type\": \"object\"" 146 " \"type\": \"object\""
147 "}")); 147 "}"));
148 } 148 }
149 149
150 } // namespace extensions 150 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/common/auto_start_linux.cc ('k') | chrome/common/extensions/extension_file_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698