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