| 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 "base/string_util.h" | 5 #include "base/string_util.h" |
| 6 #include "chrome/app/chrome_command_ids.h" | 6 #include "chrome/app/chrome_command_ids.h" |
| 7 #include "chrome/browser/extensions/extension_browsertest.h" | 7 #include "chrome/browser/extensions/extension_browsertest.h" |
| 8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
| 9 #include "chrome/browser/extensions/theme_installed_infobar_delegate.h" | 9 #include "chrome/browser/extensions/theme_installed_infobar_delegate.h" |
| 10 #include "chrome/browser/infobars/infobar_tab_helper.h" | 10 #include "chrome/browser/infobars/infobar_tab_helper.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 void InstallThemeAndVerify(const char* theme_name, | 43 void InstallThemeAndVerify(const char* theme_name, |
| 44 const std::string& expected_name) { | 44 const std::string& expected_name) { |
| 45 const FilePath theme_path = test_data_dir_.AppendASCII(theme_name); | 45 const FilePath theme_path = test_data_dir_.AppendASCII(theme_name); |
| 46 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(theme_path, 1, browser())); | 46 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(theme_path, 1, browser())); |
| 47 const Extension* theme = GetTheme(); | 47 const Extension* theme = GetTheme(); |
| 48 ASSERT_TRUE(theme); | 48 ASSERT_TRUE(theme); |
| 49 ASSERT_EQ(theme->name(), expected_name); | 49 ASSERT_EQ(theme->name(), expected_name); |
| 50 } | 50 } |
| 51 | 51 |
| 52 const Extension* GetTheme() const { | 52 const Extension* GetTheme() const { |
| 53 Profile* profile = browser()->profile(); | 53 return ThemeServiceFactory::GetThemeForProfile(browser()->profile()); |
| 54 std::string theme_id = ThemeService::GetThemeIDForProfile(profile); | |
| 55 return | |
| 56 (theme_id == ThemeService::kDefaultThemeID) ? | |
| 57 NULL : | |
| 58 profile->GetExtensionService()->GetExtensionById(theme_id, false); | |
| 59 } | 54 } |
| 60 }; | 55 }; |
| 61 | 56 |
| 62 #if defined(OS_LINUX) | 57 #if defined(OS_LINUX) |
| 63 // Fails consistently on bot chromium.chromiumos \ Linux. | 58 // Fails consistently on bot chromium.chromiumos \ Linux. |
| 64 // See: http://crbug.com/120647. | 59 // See: http://crbug.com/120647. |
| 65 #define MAYBE_TestThemeInstallUndoResetsToDefault DISABLED_TestThemeInstallUndoR
esetsToDefault | 60 #define MAYBE_TestThemeInstallUndoResetsToDefault DISABLED_TestThemeInstallUndoR
esetsToDefault |
| 66 #else | 61 #else |
| 67 #define MAYBE_TestThemeInstallUndoResetsToDefault TestThemeInstallUndoResetsToDe
fault | 62 #define MAYBE_TestThemeInstallUndoResetsToDefault TestThemeInstallUndoResetsToDe
fault |
| 68 #endif | 63 #endif |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 if (NewTabUI::ShouldShowApps()) { | 154 if (NewTabUI::ShouldShowApps()) { |
| 160 EXPECT_EQ(num_normal_tabs + 1, browser()->tab_count()); | 155 EXPECT_EQ(num_normal_tabs + 1, browser()->tab_count()); |
| 161 WebContents* web_contents = chrome::GetActiveWebContents(browser()); | 156 WebContents* web_contents = chrome::GetActiveWebContents(browser()); |
| 162 ASSERT_TRUE(web_contents); | 157 ASSERT_TRUE(web_contents); |
| 163 EXPECT_TRUE(StartsWithASCII(web_contents->GetURL().spec(), | 158 EXPECT_TRUE(StartsWithASCII(web_contents->GetURL().spec(), |
| 164 "chrome://newtab/", false)); | 159 "chrome://newtab/", false)); |
| 165 } else { | 160 } else { |
| 166 // TODO(xiyuan): Figure out how to test extension installed bubble? | 161 // TODO(xiyuan): Figure out how to test extension installed bubble? |
| 167 } | 162 } |
| 168 } | 163 } |
| OLD | NEW |