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