| 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/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
| 9 #include "base/json/json_file_value_serializer.h" | 9 #include "base/json/json_file_value_serializer.h" |
| 10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 FilePath star_gazing_path = GetStarGazingPath(); | 402 FilePath star_gazing_path = GetStarGazingPath(); |
| 403 FilePath manifest_path = | 403 FilePath manifest_path = |
| 404 star_gazing_path.AppendASCII("manifest.json"); | 404 star_gazing_path.AppendASCII("manifest.json"); |
| 405 std::string error; | 405 std::string error; |
| 406 JSONFileValueSerializer serializer(manifest_path); | 406 JSONFileValueSerializer serializer(manifest_path); |
| 407 scoped_ptr<DictionaryValue> valid_value( | 407 scoped_ptr<DictionaryValue> valid_value( |
| 408 static_cast<DictionaryValue*>(serializer.Deserialize(NULL, &error))); | 408 static_cast<DictionaryValue*>(serializer.Deserialize(NULL, &error))); |
| 409 EXPECT_EQ("", error); | 409 EXPECT_EQ("", error); |
| 410 ASSERT_TRUE(valid_value.get()); | 410 ASSERT_TRUE(valid_value.get()); |
| 411 scoped_refptr<Extension> extension(Extension::Create( | 411 scoped_refptr<Extension> extension(Extension::Create( |
| 412 star_gazing_path, Extension::INVALID, *valid_value, | 412 star_gazing_path, extensions::Manifest::INVALID_LOCATION, *valid_value, |
| 413 Extension::REQUIRE_KEY, &error)); | 413 Extension::REQUIRE_KEY, &error)); |
| 414 ASSERT_TRUE(extension.get()); | 414 ASSERT_TRUE(extension.get()); |
| 415 ASSERT_EQ("", error); | 415 ASSERT_EQ("", error); |
| 416 | 416 |
| 417 scoped_refptr<BrowserThemePack> pack( | 417 scoped_refptr<BrowserThemePack> pack( |
| 418 BrowserThemePack::BuildFromExtension(extension.get())); | 418 BrowserThemePack::BuildFromExtension(extension.get())); |
| 419 ASSERT_TRUE(pack.get()); | 419 ASSERT_TRUE(pack.get()); |
| 420 ASSERT_TRUE(pack->WriteToDisk(file)); | 420 ASSERT_TRUE(pack->WriteToDisk(file)); |
| 421 VerifyStarGazing(pack.get()); | 421 VerifyStarGazing(pack.get()); |
| 422 } | 422 } |
| 423 | 423 |
| 424 // Part 2: Try to read back the data pack that we just wrote to disk. | 424 // Part 2: Try to read back the data pack that we just wrote to disk. |
| 425 { | 425 { |
| 426 scoped_refptr<BrowserThemePack> pack = | 426 scoped_refptr<BrowserThemePack> pack = |
| 427 BrowserThemePack::BuildFromDataPack( | 427 BrowserThemePack::BuildFromDataPack( |
| 428 file, "mblmlcbknbnfebdfjnolmcapmdofhmme"); | 428 file, "mblmlcbknbnfebdfjnolmcapmdofhmme"); |
| 429 ASSERT_TRUE(pack.get()); | 429 ASSERT_TRUE(pack.get()); |
| 430 VerifyStarGazing(pack.get()); | 430 VerifyStarGazing(pack.get()); |
| 431 } | 431 } |
| 432 } | 432 } |
| OLD | NEW |