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

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

Issue 16950028: Move file_util::Delete to the base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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/browser/extensions/api/storage/storage_schema_manifest_handler. h" 5 #include "chrome/browser/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 30 matching lines...) Expand all
41 41
42 scoped_refptr<Extension> CreateExtension(const std::string& schema) { 42 scoped_refptr<Extension> CreateExtension(const std::string& schema) {
43 std::string error; 43 std::string error;
44 scoped_refptr<Extension> extension = Extension::Create( 44 scoped_refptr<Extension> extension = Extension::Create(
45 temp_dir_.path(), Manifest::UNPACKED, manifest_, 45 temp_dir_.path(), Manifest::UNPACKED, manifest_,
46 Extension::NO_FLAGS, "", &error); 46 Extension::NO_FLAGS, "", &error);
47 if (!extension.get()) 47 if (!extension.get())
48 return NULL; 48 return NULL;
49 base::FilePath schema_path = temp_dir_.path().AppendASCII("schema.json"); 49 base::FilePath schema_path = temp_dir_.path().AppendASCII("schema.json");
50 if (schema.empty()) { 50 if (schema.empty()) {
51 file_util::Delete(schema_path, false); 51 base::Delete(schema_path, false);
52 } else { 52 } else {
53 if (file_util::WriteFile(schema_path, schema.data(), schema.size()) != 53 if (file_util::WriteFile(schema_path, schema.data(), schema.size()) !=
54 static_cast<int>(schema.size())) { 54 static_cast<int>(schema.size())) {
55 return NULL; 55 return NULL;
56 } 56 }
57 } 57 }
58 return extension; 58 return extension;
59 } 59 }
60 60
61 testing::AssertionResult Validates(const std::string& schema) { 61 testing::AssertionResult Validates(const std::string& schema) {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 154
155 // All good now. 155 // All good now.
156 EXPECT_TRUE(Validates( 156 EXPECT_TRUE(Validates(
157 "{" 157 "{"
158 " \"$schema\": \"http://json-schema.org/draft-03/schema#\"," 158 " \"$schema\": \"http://json-schema.org/draft-03/schema#\","
159 " \"type\": \"object\"" 159 " \"type\": \"object\""
160 "}")); 160 "}"));
161 } 161 }
162 162
163 } // namespace extensions 163 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698