| 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/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 | 386 |
| 387 EXPECT_FALSE(LoadRawBitmapsTo(out_file_paths)); | 387 EXPECT_FALSE(LoadRawBitmapsTo(out_file_paths)); |
| 388 } | 388 } |
| 389 | 389 |
| 390 // TODO(erg): This test should actually test more of the built resources from | 390 // TODO(erg): This test should actually test more of the built resources from |
| 391 // the extension data, but for now, exists so valgrind can test some of the | 391 // the extension data, but for now, exists so valgrind can test some of the |
| 392 // tricky memory stuff that BrowserThemePack does. | 392 // tricky memory stuff that BrowserThemePack does. |
| 393 TEST_F(BrowserThemePackTest, CanBuildAndReadPack) { | 393 TEST_F(BrowserThemePackTest, CanBuildAndReadPack) { |
| 394 ScopedTempDir dir; | 394 ScopedTempDir dir; |
| 395 ASSERT_TRUE(dir.CreateUniqueTempDir()); | 395 ASSERT_TRUE(dir.CreateUniqueTempDir()); |
| 396 FilePath file = dir.path().Append(FILE_PATH_LITERAL("data.pak")); | 396 FilePath file = dir.path().AppendASCII("data.pak"); |
| 397 | 397 |
| 398 // Part 1: Build the pack from an extension. | 398 // Part 1: Build the pack from an extension. |
| 399 { | 399 { |
| 400 FilePath star_gazing_path = GetStarGazingPath(); | 400 FilePath star_gazing_path = GetStarGazingPath(); |
| 401 FilePath manifest_path = | 401 FilePath manifest_path = |
| 402 star_gazing_path.AppendASCII("manifest.json"); | 402 star_gazing_path.AppendASCII("manifest.json"); |
| 403 std::string error; | 403 std::string error; |
| 404 JSONFileValueSerializer serializer(manifest_path); | 404 JSONFileValueSerializer serializer(manifest_path); |
| 405 scoped_ptr<DictionaryValue> valid_value( | 405 scoped_ptr<DictionaryValue> valid_value( |
| 406 static_cast<DictionaryValue*>(serializer.Deserialize(NULL, &error))); | 406 static_cast<DictionaryValue*>(serializer.Deserialize(NULL, &error))); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 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 |