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

Side by Side Diff: extensions/browser/image_loader_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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/browser/image_loader.h" 5 #include "extensions/browser/image_loader.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/json/json_file_value_serializer.h" 8 #include "base/json/json_file_value_serializer.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 Manifest::Location location) { 72 Manifest::Location location) {
73 // Create and load an extension. 73 // Create and load an extension.
74 base::FilePath extension_dir; 74 base::FilePath extension_dir;
75 if (!PathService::Get(DIR_TEST_DATA, &extension_dir)) { 75 if (!PathService::Get(DIR_TEST_DATA, &extension_dir)) {
76 EXPECT_FALSE(true); 76 EXPECT_FALSE(true);
77 return NULL; 77 return NULL;
78 } 78 }
79 extension_dir = extension_dir.AppendASCII(dir_name); 79 extension_dir = extension_dir.AppendASCII(dir_name);
80 int error_code = 0; 80 int error_code = 0;
81 std::string error; 81 std::string error;
82 JSONFileValueSerializer serializer( 82 JSONFileValueDeserializer deserializer(
83 extension_dir.AppendASCII("manifest.json")); 83 extension_dir.AppendASCII("manifest.json"));
84 scoped_ptr<base::DictionaryValue> valid_value( 84 scoped_ptr<base::DictionaryValue> valid_value(
85 static_cast<base::DictionaryValue*>(serializer.Deserialize(&error_code, 85 static_cast<base::DictionaryValue*>(
86 &error))); 86 deserializer.Deserialize(&error_code, &error)));
87 EXPECT_EQ(0, error_code) << error; 87 EXPECT_EQ(0, error_code) << error;
88 if (error_code != 0) 88 if (error_code != 0)
89 return NULL; 89 return NULL;
90 90
91 EXPECT_TRUE(valid_value.get()); 91 EXPECT_TRUE(valid_value.get());
92 if (!valid_value) 92 if (!valid_value)
93 return NULL; 93 return NULL;
94 94
95 return Extension::Create( 95 return Extension::Create(
96 extension_dir, location, *valid_value, Extension::NO_FLAGS, &error); 96 extension_dir, location, *valid_value, Extension::NO_FLAGS, &error);
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 304
305 const gfx::ImageSkiaRep* img_rep1 = &image_reps[0]; 305 const gfx::ImageSkiaRep* img_rep1 = &image_reps[0];
306 const gfx::ImageSkiaRep* img_rep2 = &image_reps[1]; 306 const gfx::ImageSkiaRep* img_rep2 = &image_reps[1];
307 EXPECT_EQ(extension_misc::EXTENSION_ICON_BITTY, img_rep1->pixel_width()); 307 EXPECT_EQ(extension_misc::EXTENSION_ICON_BITTY, img_rep1->pixel_width());
308 EXPECT_EQ(1.0f, img_rep1->scale()); 308 EXPECT_EQ(1.0f, img_rep1->scale());
309 EXPECT_EQ(extension_misc::EXTENSION_ICON_SMALLISH, img_rep2->pixel_width()); 309 EXPECT_EQ(extension_misc::EXTENSION_ICON_SMALLISH, img_rep2->pixel_width());
310 EXPECT_EQ(2.0f, img_rep2->scale()); 310 EXPECT_EQ(2.0f, img_rep2->scale());
311 } 311 }
312 312
313 } // namespace extensions 313 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/extension_icon_image_unittest.cc ('k') | extensions/common/extension_l10n_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698