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

Side by Side Diff: extensions/common/file_util_unittest.cc

Issue 925783002: Split ValueSerializer into separate Serializer and Deserializer classes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed cpplint warnings. Created 5 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
« no previous file with comments | « extensions/common/file_util.cc ('k') | extensions/common/manifest_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 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 "extensions/common/file_util.h" 5 #include "extensions/common/file_util.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/json/json_string_value_serializer.h" 10 #include "base/json/json_string_value_serializer.h"
(...skipping 25 matching lines...) Expand all
36 Extension::Create(manifest_dir, location, *manifest, extra_flags, error); 36 Extension::Create(manifest_dir, location, *manifest, extra_flags, error);
37 return extension; 37 return extension;
38 } 38 }
39 39
40 scoped_refptr<Extension> LoadExtensionManifest( 40 scoped_refptr<Extension> LoadExtensionManifest(
41 const std::string& manifest_value, 41 const std::string& manifest_value,
42 const base::FilePath& manifest_dir, 42 const base::FilePath& manifest_dir,
43 Manifest::Location location, 43 Manifest::Location location,
44 int extra_flags, 44 int extra_flags,
45 std::string* error) { 45 std::string* error) {
46 JSONStringValueSerializer serializer(manifest_value); 46 JSONStringValueDeserializer deserializer(manifest_value);
47 scoped_ptr<base::Value> result(serializer.Deserialize(NULL, error)); 47 scoped_ptr<base::Value> result(deserializer.Deserialize(NULL, error));
48 if (!result.get()) 48 if (!result.get())
49 return NULL; 49 return NULL;
50 CHECK_EQ(base::Value::TYPE_DICTIONARY, result->GetType()); 50 CHECK_EQ(base::Value::TYPE_DICTIONARY, result->GetType());
51 return LoadExtensionManifest( 51 return LoadExtensionManifest(
52 static_cast<base::DictionaryValue*>(result.get()), 52 static_cast<base::DictionaryValue*>(result.get()),
53 manifest_dir, 53 manifest_dir,
54 location, 54 location,
55 extra_flags, 55 extra_flags,
56 error); 56 error);
57 } 57 }
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 base::FilePath actual_path = 496 base::FilePath actual_path =
497 extensions::file_util::ExtensionResourceURLToFilePath(url, root_path); 497 extensions::file_util::ExtensionResourceURLToFilePath(url, root_path);
498 EXPECT_EQ(expected_path.value(), actual_path.value()) << 498 EXPECT_EQ(expected_path.value(), actual_path.value()) <<
499 " For the path " << url; 499 " For the path " << url;
500 } 500 }
501 // Remove temp files. 501 // Remove temp files.
502 ASSERT_TRUE(base::DeleteFile(root_path, true)); 502 ASSERT_TRUE(base::DeleteFile(root_path, true));
503 } 503 }
504 504
505 } // namespace extensions 505 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/file_util.cc ('k') | extensions/common/manifest_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698