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

Side by Side Diff: extensions/browser/extension_icon_image_unittest.cc

Issue 1394993004: Make ValueDeserializer::Deserialize return scoped_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix and add todo about not failed trybot Created 5 years, 2 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 base::FilePath test_file; 97 base::FilePath test_file;
98 if (!PathService::Get(DIR_TEST_DATA, &test_file)) { 98 if (!PathService::Get(DIR_TEST_DATA, &test_file)) {
99 EXPECT_FALSE(true); 99 EXPECT_FALSE(true);
100 return NULL; 100 return NULL;
101 } 101 }
102 test_file = test_file.AppendASCII(name); 102 test_file = test_file.AppendASCII(name);
103 int error_code = 0; 103 int error_code = 0;
104 std::string error; 104 std::string error;
105 JSONFileValueDeserializer deserializer( 105 JSONFileValueDeserializer deserializer(
106 test_file.AppendASCII("manifest.json")); 106 test_file.AppendASCII("manifest.json"));
107 scoped_ptr<base::DictionaryValue> valid_value( 107 scoped_ptr<base::DictionaryValue> valid_value = base::DictionaryValue::From(
108 static_cast<base::DictionaryValue*>( 108 deserializer.Deserialize(&error_code, &error));
109 deserializer.Deserialize(&error_code, &error)));
110 EXPECT_EQ(0, error_code) << error; 109 EXPECT_EQ(0, error_code) << error;
111 if (error_code != 0) 110 if (error_code != 0)
112 return NULL; 111 return NULL;
113 112
114 EXPECT_TRUE(valid_value.get()); 113 EXPECT_TRUE(valid_value.get());
115 if (!valid_value) 114 if (!valid_value)
116 return NULL; 115 return NULL;
117 116
118 return Extension::Create(test_file, location, *valid_value, 117 return Extension::Create(test_file, location, *valid_value,
119 Extension::NO_FLAGS, &error); 118 Extension::NO_FLAGS, &error);
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 // because image storage is shared, so when we created one from the first 543 // because image storage is shared, so when we created one from the first
545 // image, all other images should also have that representation... 544 // image, all other images should also have that representation...
546 gfx::Image image2 = icon_image->image(); 545 gfx::Image image2 = icon_image->image();
547 EXPECT_EQ(image_as_png.get(), image2.As1xPNGBytes().get()); 546 EXPECT_EQ(image_as_png.get(), image2.As1xPNGBytes().get());
548 547
549 // ...even images that were copied before the representation was constructed. 548 // ...even images that were copied before the representation was constructed.
550 EXPECT_EQ(image_as_png.get(), prior_image.As1xPNGBytes().get()); 549 EXPECT_EQ(image_as_png.get(), prior_image.As1xPNGBytes().get());
551 } 550 }
552 551
553 } // namespace extensions 552 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/printer_provider/printer_provider_api.cc ('k') | extensions/browser/image_loader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698