| 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 | 216 |
| 217 int val; | 217 int val; |
| 218 EXPECT_TRUE(pack->GetDisplayProperty( | 218 EXPECT_TRUE(pack->GetDisplayProperty( |
| 219 ThemeProperties::NTP_BACKGROUND_ALIGNMENT, &val)); | 219 ThemeProperties::NTP_BACKGROUND_ALIGNMENT, &val)); |
| 220 EXPECT_EQ(ThemeProperties::ALIGN_TOP, val); | 220 EXPECT_EQ(ThemeProperties::ALIGN_TOP, val); |
| 221 | 221 |
| 222 // The stargazing theme defines the following images: | 222 // The stargazing theme defines the following images: |
| 223 EXPECT_TRUE(pack->HasCustomImage(IDR_THEME_BUTTON_BACKGROUND)); | 223 EXPECT_TRUE(pack->HasCustomImage(IDR_THEME_BUTTON_BACKGROUND)); |
| 224 EXPECT_TRUE(pack->HasCustomImage(IDR_THEME_FRAME)); | 224 EXPECT_TRUE(pack->HasCustomImage(IDR_THEME_FRAME)); |
| 225 EXPECT_TRUE(pack->HasCustomImage(IDR_THEME_NTP_BACKGROUND)); | 225 EXPECT_TRUE(pack->HasCustomImage(IDR_THEME_NTP_BACKGROUND)); |
| 226 EXPECT_TRUE(pack->HasCustomImage(IDR_THEME_TAB_BACKGROUND)); | 226 EXPECT_TRUE(pack->HasCustomImage(IDR_THEME_TAB_BACKGROUND_OVERLAY)); |
| 227 EXPECT_TRUE(pack->HasCustomImage(IDR_THEME_TOOLBAR)); | 227 EXPECT_TRUE(pack->HasCustomImage(IDR_THEME_TOOLBAR)); |
| 228 EXPECT_TRUE(pack->HasCustomImage(IDR_THEME_WINDOW_CONTROL_BACKGROUND)); | 228 EXPECT_TRUE(pack->HasCustomImage(IDR_THEME_WINDOW_CONTROL_BACKGROUND)); |
| 229 | 229 |
| 230 // Here are a few images that we shouldn't expect because even though | 230 // Here are a few images that we shouldn't expect because even though |
| 231 // they're included in the theme pack, they were autogenerated and | 231 // they're included in the theme pack, they were autogenerated and |
| 232 // therefore shouldn't show up when calling HasCustomImage(). | 232 // therefore shouldn't show up when calling HasCustomImage(). |
| 233 EXPECT_FALSE(pack->HasCustomImage(IDR_THEME_FRAME_INACTIVE)); | 233 EXPECT_FALSE(pack->HasCustomImage(IDR_THEME_FRAME_INACTIVE)); |
| 234 EXPECT_FALSE(pack->HasCustomImage(IDR_THEME_FRAME_INCOGNITO)); | 234 EXPECT_FALSE(pack->HasCustomImage(IDR_THEME_FRAME_INCOGNITO)); |
| 235 EXPECT_FALSE(pack->HasCustomImage(IDR_THEME_FRAME_INCOGNITO_INACTIVE)); | 235 EXPECT_FALSE(pack->HasCustomImage(IDR_THEME_FRAME_INCOGNITO_INACTIVE)); |
| 236 EXPECT_FALSE(pack->HasCustomImage( |
| 237 IDR_THEME_TAB_BACKGROUND_INCOGNITO_OVERLAY)); |
| 238 EXPECT_FALSE(pack->HasCustomImage(IDR_THEME_TAB_BACKGROUND)); |
| 236 EXPECT_FALSE(pack->HasCustomImage(IDR_THEME_TAB_BACKGROUND_INCOGNITO)); | 239 EXPECT_FALSE(pack->HasCustomImage(IDR_THEME_TAB_BACKGROUND_INCOGNITO)); |
| 237 | 240 |
| 238 // Make sure we don't have phantom data. | 241 // Make sure we don't have phantom data. |
| 239 EXPECT_FALSE(pack->GetColor(ThemeProperties::COLOR_CONTROL_BACKGROUND, | 242 EXPECT_FALSE(pack->GetColor(ThemeProperties::COLOR_CONTROL_BACKGROUND, |
| 240 &color)); | 243 &color)); |
| 241 EXPECT_FALSE(pack->GetTint(ThemeProperties::TINT_FRAME, &actual)); | 244 EXPECT_FALSE(pack->GetTint(ThemeProperties::TINT_FRAME, &actual)); |
| 242 } | 245 } |
| 243 | 246 |
| 244 void VerifyHiDpiTheme(BrowserThemePack* pack) { | 247 void VerifyHiDpiTheme(BrowserThemePack* pack) { |
| 245 // The high DPI theme defines the following images: | 248 // The high DPI theme defines the following images: |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 } | 605 } |
| 603 | 606 |
| 604 // Part 2: Try to read back the data pack that we just wrote to disk. | 607 // Part 2: Try to read back the data pack that we just wrote to disk. |
| 605 { | 608 { |
| 606 scoped_refptr<BrowserThemePack> pack = | 609 scoped_refptr<BrowserThemePack> pack = |
| 607 BrowserThemePack::BuildFromDataPack(file, "gllekhaobjnhgeag"); | 610 BrowserThemePack::BuildFromDataPack(file, "gllekhaobjnhgeag"); |
| 608 ASSERT_TRUE(pack.get()); | 611 ASSERT_TRUE(pack.get()); |
| 609 VerifyHiDpiTheme(pack.get()); | 612 VerifyHiDpiTheme(pack.get()); |
| 610 } | 613 } |
| 611 } | 614 } |
| OLD | NEW |