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/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
8 #include "base/json/json_file_value_serializer.h" | 8 #include "base/json/json_file_value_serializer.h" |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 EXPECT_EQ(0, out_val); | 462 EXPECT_EQ(0, out_val); |
463 } | 463 } |
464 | 464 |
465 TEST_F(BrowserThemePackTest, CanParsePaths) { | 465 TEST_F(BrowserThemePackTest, CanParsePaths) { |
466 std::string path_json = "{ \"theme_button_background\": \"one\", " | 466 std::string path_json = "{ \"theme_button_background\": \"one\", " |
467 " \"theme_toolbar\": \"two\" }"; | 467 " \"theme_toolbar\": \"two\" }"; |
468 TestFilePathMap out_file_paths; | 468 TestFilePathMap out_file_paths; |
469 ParseImageNamesJSON(path_json, &out_file_paths); | 469 ParseImageNamesJSON(path_json, &out_file_paths); |
470 | 470 |
471 size_t expected_file_paths = 2u; | 471 size_t expected_file_paths = 2u; |
472 #if defined(USE_ASH) && !defined(OS_CHROMEOS) | 472 #if defined(OS_WIN) |
473 // On desktop builds with ash, additional theme paths are generated to map to | 473 // On Windows additional theme paths are generated to map to the special |
474 // the special resource ids like IDR_THEME_FRAME_DESKTOP, etc | 474 // resource ids like IDR_THEME_FRAME_WIN, etc |
475 expected_file_paths = 3u; | 475 expected_file_paths = 3u; |
476 #endif | 476 #endif |
477 EXPECT_EQ(expected_file_paths, out_file_paths.size()); | 477 EXPECT_EQ(expected_file_paths, out_file_paths.size()); |
478 // "12" and "5" are internal constants to BrowserThemePack and are | 478 // "12" and "5" are internal constants to BrowserThemePack and are |
479 // PRS_THEME_BUTTON_BACKGROUND and PRS_THEME_TOOLBAR, but they are | 479 // PRS_THEME_BUTTON_BACKGROUND and PRS_THEME_TOOLBAR, but they are |
480 // implementation details that shouldn't be exported. | 480 // implementation details that shouldn't be exported. |
481 // By default the scale factor is for 100%. | 481 // By default the scale factor is for 100%. |
482 EXPECT_TRUE(base::FilePath(FILE_PATH_LITERAL("one")) == | 482 EXPECT_TRUE(base::FilePath(FILE_PATH_LITERAL("one")) == |
483 out_file_paths[12][ui::SCALE_FACTOR_100P]); | 483 out_file_paths[12][ui::SCALE_FACTOR_100P]); |
484 EXPECT_TRUE(base::FilePath(FILE_PATH_LITERAL("two")) == | 484 EXPECT_TRUE(base::FilePath(FILE_PATH_LITERAL("two")) == |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 } | 604 } |
605 | 605 |
606 // Part 2: Try to read back the data pack that we just wrote to disk. | 606 // Part 2: Try to read back the data pack that we just wrote to disk. |
607 { | 607 { |
608 scoped_refptr<BrowserThemePack> pack = | 608 scoped_refptr<BrowserThemePack> pack = |
609 BrowserThemePack::BuildFromDataPack(file, "gllekhaobjnhgeag"); | 609 BrowserThemePack::BuildFromDataPack(file, "gllekhaobjnhgeag"); |
610 ASSERT_TRUE(pack.get()); | 610 ASSERT_TRUE(pack.get()); |
611 VerifyHiDpiTheme(pack.get()); | 611 VerifyHiDpiTheme(pack.get()); |
612 } | 612 } |
613 } | 613 } |
OLD | NEW |