Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(609)

Side by Side Diff: chrome/browser/themes/browser_theme_pack_unittest.cc

Issue 2321453002: c/browser, c/common, components S-W: Change ScopedTempDir::path() to GetPath() (Closed)
Patch Set: Just rebased Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/json/json_file_value_serializer.h" 10 #include "base/json/json_file_value_serializer.h"
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 609
610 EXPECT_FALSE(LoadRawBitmapsTo(out_file_paths)); 610 EXPECT_FALSE(LoadRawBitmapsTo(out_file_paths));
611 } 611 }
612 612
613 // TODO(erg): This test should actually test more of the built resources from 613 // TODO(erg): This test should actually test more of the built resources from
614 // the extension data, but for now, exists so valgrind can test some of the 614 // the extension data, but for now, exists so valgrind can test some of the
615 // tricky memory stuff that BrowserThemePack does. 615 // tricky memory stuff that BrowserThemePack does.
616 TEST_F(BrowserThemePackTest, CanBuildAndReadPack) { 616 TEST_F(BrowserThemePackTest, CanBuildAndReadPack) {
617 base::ScopedTempDir dir; 617 base::ScopedTempDir dir;
618 ASSERT_TRUE(dir.CreateUniqueTempDir()); 618 ASSERT_TRUE(dir.CreateUniqueTempDir());
619 base::FilePath file = dir.path().AppendASCII("data.pak"); 619 base::FilePath file = dir.GetPath().AppendASCII("data.pak");
620 620
621 // Part 1: Build the pack from an extension. 621 // Part 1: Build the pack from an extension.
622 { 622 {
623 base::FilePath star_gazing_path = GetStarGazingPath(); 623 base::FilePath star_gazing_path = GetStarGazingPath();
624 scoped_refptr<BrowserThemePack> pack; 624 scoped_refptr<BrowserThemePack> pack;
625 BuildFromUnpackedExtension(star_gazing_path, pack); 625 BuildFromUnpackedExtension(star_gazing_path, pack);
626 ASSERT_TRUE(pack->WriteToDisk(file)); 626 ASSERT_TRUE(pack->WriteToDisk(file));
627 VerifyStarGazing(pack.get()); 627 VerifyStarGazing(pack.get());
628 } 628 }
629 629
630 // Part 2: Try to read back the data pack that we just wrote to disk. 630 // Part 2: Try to read back the data pack that we just wrote to disk.
631 { 631 {
632 scoped_refptr<BrowserThemePack> pack = 632 scoped_refptr<BrowserThemePack> pack =
633 BrowserThemePack::BuildFromDataPack( 633 BrowserThemePack::BuildFromDataPack(
634 file, "mblmlcbknbnfebdfjnolmcapmdofhmme"); 634 file, "mblmlcbknbnfebdfjnolmcapmdofhmme");
635 ASSERT_TRUE(pack.get()); 635 ASSERT_TRUE(pack.get());
636 VerifyStarGazing(pack.get()); 636 VerifyStarGazing(pack.get());
637 } 637 }
638 } 638 }
639 639
640 TEST_F(BrowserThemePackTest, HiDpiThemeTest) { 640 TEST_F(BrowserThemePackTest, HiDpiThemeTest) {
641 base::ScopedTempDir dir; 641 base::ScopedTempDir dir;
642 ASSERT_TRUE(dir.CreateUniqueTempDir()); 642 ASSERT_TRUE(dir.CreateUniqueTempDir());
643 base::FilePath file = dir.path().AppendASCII("theme_data.pak"); 643 base::FilePath file = dir.GetPath().AppendASCII("theme_data.pak");
644 644
645 // Part 1: Build the pack from an extension. 645 // Part 1: Build the pack from an extension.
646 { 646 {
647 base::FilePath hidpi_path = GetHiDpiThemePath(); 647 base::FilePath hidpi_path = GetHiDpiThemePath();
648 scoped_refptr<BrowserThemePack> pack; 648 scoped_refptr<BrowserThemePack> pack;
649 BuildFromUnpackedExtension(hidpi_path, pack); 649 BuildFromUnpackedExtension(hidpi_path, pack);
650 ASSERT_TRUE(pack->WriteToDisk(file)); 650 ASSERT_TRUE(pack->WriteToDisk(file));
651 VerifyHiDpiTheme(pack.get()); 651 VerifyHiDpiTheme(pack.get());
652 } 652 }
653 653
654 // Part 2: Try to read back the data pack that we just wrote to disk. 654 // Part 2: Try to read back the data pack that we just wrote to disk.
655 { 655 {
656 scoped_refptr<BrowserThemePack> pack = 656 scoped_refptr<BrowserThemePack> pack =
657 BrowserThemePack::BuildFromDataPack(file, "gllekhaobjnhgeag"); 657 BrowserThemePack::BuildFromDataPack(file, "gllekhaobjnhgeag");
658 ASSERT_TRUE(pack.get()); 658 ASSERT_TRUE(pack.get());
659 VerifyHiDpiTheme(pack.get()); 659 VerifyHiDpiTheme(pack.get());
660 } 660 }
661 } 661 }
OLDNEW
« no previous file with comments | « chrome/browser/ssl/ssl_browser_tests.cc ('k') | chrome/browser/themes/theme_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698