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

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

Issue 11968032: Move 'theme' parsing out of Extension class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed IncognitoAutofillManagerTest unittest Created 7 years, 10 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
« no previous file with comments | « chrome/browser/themes/browser_theme_pack.cc ('k') | chrome/browser/themes/theme_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/json/json_file_value_serializer.h" 9 #include "base/json/json_file_value_serializer.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "chrome/browser/themes/theme_service.h" 14 #include "chrome/browser/themes/theme_service.h"
15 #include "chrome/common/chrome_paths.h" 15 #include "chrome/common/chrome_paths.h"
16 #include "chrome/common/extensions/api/themes/theme_handler.h"
17 #include "chrome/common/extensions/extension_manifest_constants.h"
18 #include "chrome/common/extensions/manifest_handler.h"
16 #include "content/public/test/test_browser_thread.h" 19 #include "content/public/test/test_browser_thread.h"
17 #include "grit/theme_resources.h" 20 #include "grit/theme_resources.h"
18 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
19 #include "ui/gfx/color_utils.h" 22 #include "ui/gfx/color_utils.h"
20 23
21 using content::BrowserThread; 24 using content::BrowserThread;
22 using extensions::Extension; 25 using extensions::Extension;
23 26
24 class BrowserThemePackTest : public ::testing::Test { 27 class BrowserThemePackTest : public ::testing::Test {
25 public: 28 public:
26 BrowserThemePackTest() 29 BrowserThemePackTest()
27 : message_loop(), 30 : message_loop(),
28 fake_ui_thread(BrowserThread::UI, &message_loop), 31 fake_ui_thread(BrowserThread::UI, &message_loop),
29 fake_file_thread(BrowserThread::FILE, &message_loop), 32 fake_file_thread(BrowserThread::FILE, &message_loop),
30 theme_pack_(new BrowserThemePack) { 33 theme_pack_(new BrowserThemePack) {
31 } 34 }
32 35
36 virtual void SetUp() OVERRIDE {
37 testing::Test::SetUp();
38 extensions::ManifestHandler::Register(
39 extension_manifest_keys::kTheme,
40 make_linked_ptr(new extensions::ThemeHandler));
41 }
42
33 // Transformation for link underline colors. 43 // Transformation for link underline colors.
34 SkColor BuildThirdOpacity(SkColor color_link) { 44 SkColor BuildThirdOpacity(SkColor color_link) {
35 return SkColorSetA(color_link, SkColorGetA(color_link) / 3); 45 return SkColorSetA(color_link, SkColorGetA(color_link) / 3);
36 } 46 }
37 47
38 void GenerateDefaultFrameColor(std::map<int, SkColor>* colors, 48 void GenerateDefaultFrameColor(std::map<int, SkColor>* colors,
39 int color, int tint) { 49 int color, int tint) {
40 (*colors)[color] = HSLShift( 50 (*colors)[color] = HSLShift(
41 ThemeService::GetDefaultColor( 51 ThemeService::GetDefaultColor(
42 ThemeService::COLOR_FRAME), 52 ThemeService::COLOR_FRAME),
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 434
425 // Part 2: Try to read back the data pack that we just wrote to disk. 435 // Part 2: Try to read back the data pack that we just wrote to disk.
426 { 436 {
427 scoped_refptr<BrowserThemePack> pack = 437 scoped_refptr<BrowserThemePack> pack =
428 BrowserThemePack::BuildFromDataPack( 438 BrowserThemePack::BuildFromDataPack(
429 file, "mblmlcbknbnfebdfjnolmcapmdofhmme"); 439 file, "mblmlcbknbnfebdfjnolmcapmdofhmme");
430 ASSERT_TRUE(pack.get()); 440 ASSERT_TRUE(pack.get());
431 VerifyStarGazing(pack.get()); 441 VerifyStarGazing(pack.get());
432 } 442 }
433 } 443 }
OLDNEW
« no previous file with comments | « chrome/browser/themes/browser_theme_pack.cc ('k') | chrome/browser/themes/theme_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698