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

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: 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(
108 static_cast<base::DictionaryValue*>( 108 static_cast<base::DictionaryValue*>(
109 deserializer.Deserialize(&error_code, &error))); 109 deserializer.Deserialize(&error_code, &error).release()));
110 EXPECT_EQ(0, error_code) << error; 110 EXPECT_EQ(0, error_code) << error;
111 if (error_code != 0) 111 if (error_code != 0)
112 return NULL; 112 return NULL;
113 113
114 EXPECT_TRUE(valid_value.get()); 114 EXPECT_TRUE(valid_value.get());
115 if (!valid_value) 115 if (!valid_value)
116 return NULL; 116 return NULL;
117 117
118 return Extension::Create(test_file, location, *valid_value, 118 return Extension::Create(test_file, location, *valid_value,
119 Extension::NO_FLAGS, &error); 119 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 544 // because image storage is shared, so when we created one from the first
545 // image, all other images should also have that representation... 545 // image, all other images should also have that representation...
546 gfx::Image image2 = icon_image->image(); 546 gfx::Image image2 = icon_image->image();
547 EXPECT_EQ(image_as_png.get(), image2.As1xPNGBytes().get()); 547 EXPECT_EQ(image_as_png.get(), image2.As1xPNGBytes().get());
548 548
549 // ...even images that were copied before the representation was constructed. 549 // ...even images that were copied before the representation was constructed.
550 EXPECT_EQ(image_as_png.get(), prior_image.As1xPNGBytes().get()); 550 EXPECT_EQ(image_as_png.get(), prior_image.As1xPNGBytes().get());
551 } 551 }
552 552
553 } // namespace extensions 553 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698