| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/browser_theme_pack.h" | 5 #include "chrome/browser/browser_theme_pack.h" |
| 6 | 6 |
| 7 #include "app/theme_provider.h" | 7 #include "app/theme_provider.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.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 // Part 1: Build the pack from an extension. | 399 // Part 1: Build the pack from an extension. |
| 400 { | 400 { |
| 401 FilePath star_gazing_path = GetStarGazingPath(); | 401 FilePath star_gazing_path = GetStarGazingPath(); |
| 402 Extension extension(star_gazing_path); | 402 Extension extension(star_gazing_path); |
| 403 | 403 |
| 404 FilePath manifest_path = | 404 FilePath manifest_path = |
| 405 star_gazing_path.AppendASCII("manifest.json"); | 405 star_gazing_path.AppendASCII("manifest.json"); |
| 406 std::string error; | 406 std::string error; |
| 407 JSONFileValueSerializer serializer(manifest_path); | 407 JSONFileValueSerializer serializer(manifest_path); |
| 408 scoped_ptr<DictionaryValue> valid_value( | 408 scoped_ptr<DictionaryValue> valid_value( |
| 409 static_cast<DictionaryValue*>(serializer.Deserialize(&error))); | 409 static_cast<DictionaryValue*>(serializer.Deserialize(NULL, &error))); |
| 410 EXPECT_EQ("", error); | 410 EXPECT_EQ("", error); |
| 411 ASSERT_TRUE(valid_value.get()); | 411 ASSERT_TRUE(valid_value.get()); |
| 412 ASSERT_TRUE(extension.InitFromValue(*valid_value, true, &error)); | 412 ASSERT_TRUE(extension.InitFromValue(*valid_value, true, &error)); |
| 413 ASSERT_EQ("", error); | 413 ASSERT_EQ("", error); |
| 414 | 414 |
| 415 scoped_refptr<BrowserThemePack> pack = | 415 scoped_refptr<BrowserThemePack> pack = |
| 416 BrowserThemePack::BuildFromExtension(&extension); | 416 BrowserThemePack::BuildFromExtension(&extension); |
| 417 ASSERT_TRUE(pack.get()); | 417 ASSERT_TRUE(pack.get()); |
| 418 ASSERT_TRUE(pack->WriteToDisk(file)); | 418 ASSERT_TRUE(pack->WriteToDisk(file)); |
| 419 VerifyStarGazing(pack.get()); | 419 VerifyStarGazing(pack.get()); |
| 420 } | 420 } |
| 421 | 421 |
| 422 // Part 2: Try to read back the data pack that we just wrote to disk. | 422 // Part 2: Try to read back the data pack that we just wrote to disk. |
| 423 { | 423 { |
| 424 scoped_refptr<BrowserThemePack> pack = | 424 scoped_refptr<BrowserThemePack> pack = |
| 425 BrowserThemePack::BuildFromDataPack( | 425 BrowserThemePack::BuildFromDataPack( |
| 426 file, "mblmlcbknbnfebdfjnolmcapmdofhmme"); | 426 file, "mblmlcbknbnfebdfjnolmcapmdofhmme"); |
| 427 ASSERT_TRUE(pack.get()); | 427 ASSERT_TRUE(pack.get()); |
| 428 VerifyStarGazing(pack.get()); | 428 VerifyStarGazing(pack.get()); |
| 429 } | 429 } |
| 430 } | 430 } |
| OLD | NEW |