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

Side by Side Diff: extensions/browser/extension_icon_image_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/extension_icon_image.h" 5 #include "extensions/browser/extension_icon_image.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/json/json_file_value_serializer.h" 9 #include "base/json/json_file_value_serializer.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 Manifest::Location location) { 143 Manifest::Location location) {
144 // Create and load an extension. 144 // Create and load an extension.
145 base::FilePath test_file; 145 base::FilePath test_file;
146 if (!PathService::Get(DIR_TEST_DATA, &test_file)) { 146 if (!PathService::Get(DIR_TEST_DATA, &test_file)) {
147 EXPECT_FALSE(true); 147 EXPECT_FALSE(true);
148 return NULL; 148 return NULL;
149 } 149 }
150 test_file = test_file.AppendASCII(name); 150 test_file = test_file.AppendASCII(name);
151 int error_code = 0; 151 int error_code = 0;
152 std::string error; 152 std::string error;
153 JSONFileValueSerializer serializer(test_file.AppendASCII("manifest.json")); 153 JSONFileValueDeserializer deserializer(
154 test_file.AppendASCII("manifest.json"));
154 scoped_ptr<base::DictionaryValue> valid_value( 155 scoped_ptr<base::DictionaryValue> valid_value(
155 static_cast<base::DictionaryValue*>(serializer.Deserialize(&error_code, 156 static_cast<base::DictionaryValue*>(
156 &error))); 157 deserializer.Deserialize(&error_code, &error)));
157 EXPECT_EQ(0, error_code) << error; 158 EXPECT_EQ(0, error_code) << error;
158 if (error_code != 0) 159 if (error_code != 0)
159 return NULL; 160 return NULL;
160 161
161 EXPECT_TRUE(valid_value.get()); 162 EXPECT_TRUE(valid_value.get());
162 if (!valid_value) 163 if (!valid_value)
163 return NULL; 164 return NULL;
164 165
165 return Extension::Create(test_file, location, *valid_value, 166 return Extension::Create(test_file, location, *valid_value,
166 Extension::NO_FLAGS, &error); 167 Extension::NO_FLAGS, &error);
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 // because image storage is shared, so when we created one from the first 597 // because image storage is shared, so when we created one from the first
597 // image, all other images should also have that representation... 598 // image, all other images should also have that representation...
598 gfx::Image image2 = icon_image->image(); 599 gfx::Image image2 = icon_image->image();
599 EXPECT_EQ(image_as_png.get(), image2.As1xPNGBytes().get()); 600 EXPECT_EQ(image_as_png.get(), image2.As1xPNGBytes().get());
600 601
601 // ...even images that were copied before the representation was constructed. 602 // ...even images that were copied before the representation was constructed.
602 EXPECT_EQ(image_as_png.get(), prior_image.As1xPNGBytes().get()); 603 EXPECT_EQ(image_as_png.get(), prior_image.As1xPNGBytes().get());
603 } 604 }
604 605
605 } // namespace extensions 606 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/printer_provider/printer_provider_apitest.cc ('k') | extensions/browser/image_loader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698