OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/themes/browser_theme_pack.h" | 5 #include "chrome/browser/themes/browser_theme_pack.h" |
6 | 6 |
7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
8 #include "base/json/json_file_value_serializer.h" | 8 #include "base/json/json_file_value_serializer.h" |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 } | 148 } |
149 | 149 |
150 // This function returns void in order to be able use ASSERT_... | 150 // This function returns void in order to be able use ASSERT_... |
151 // The BrowserThemePack is returned in |pack|. | 151 // The BrowserThemePack is returned in |pack|. |
152 void BuildFromUnpackedExtension(const base::FilePath& extension_path, | 152 void BuildFromUnpackedExtension(const base::FilePath& extension_path, |
153 scoped_refptr<BrowserThemePack>& pack) { | 153 scoped_refptr<BrowserThemePack>& pack) { |
154 base::FilePath manifest_path = | 154 base::FilePath manifest_path = |
155 extension_path.AppendASCII("manifest.json"); | 155 extension_path.AppendASCII("manifest.json"); |
156 std::string error; | 156 std::string error; |
157 JSONFileValueDeserializer deserializer(manifest_path); | 157 JSONFileValueDeserializer deserializer(manifest_path); |
158 scoped_ptr<base::DictionaryValue> valid_value( | 158 scoped_ptr<base::DictionaryValue> valid_value = |
159 static_cast<base::DictionaryValue*>( | 159 base::DictionaryValue::From(deserializer.Deserialize(NULL, &error)); |
160 deserializer.Deserialize(NULL, &error))); | |
161 EXPECT_EQ("", error); | 160 EXPECT_EQ("", error); |
162 ASSERT_TRUE(valid_value.get()); | 161 ASSERT_TRUE(valid_value.get()); |
163 scoped_refptr<Extension> extension( | 162 scoped_refptr<Extension> extension( |
164 Extension::Create( | 163 Extension::Create( |
165 extension_path, | 164 extension_path, |
166 extensions::Manifest::INVALID_LOCATION, | 165 extensions::Manifest::INVALID_LOCATION, |
167 *valid_value, | 166 *valid_value, |
168 Extension::REQUIRE_KEY, | 167 Extension::REQUIRE_KEY, |
169 &error)); | 168 &error)); |
170 ASSERT_TRUE(extension.get()); | 169 ASSERT_TRUE(extension.get()); |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 } | 621 } |
623 | 622 |
624 // Part 2: Try to read back the data pack that we just wrote to disk. | 623 // Part 2: Try to read back the data pack that we just wrote to disk. |
625 { | 624 { |
626 scoped_refptr<BrowserThemePack> pack = | 625 scoped_refptr<BrowserThemePack> pack = |
627 BrowserThemePack::BuildFromDataPack(file, "gllekhaobjnhgeag"); | 626 BrowserThemePack::BuildFromDataPack(file, "gllekhaobjnhgeag"); |
628 ASSERT_TRUE(pack.get()); | 627 ASSERT_TRUE(pack.get()); |
629 VerifyHiDpiTheme(pack.get()); | 628 VerifyHiDpiTheme(pack.get()); |
630 } | 629 } |
631 } | 630 } |
OLD | NEW |