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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/strings/string_util.h" | 6 #include "base/strings/string_util.h" |
7 #include "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
9 #include "chrome/browser/extensions/extension_browsertest.h" | 9 #include "chrome/browser/extensions/extension_browsertest.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 // See: http://crbug.com/120647. | 75 // See: http://crbug.com/120647. |
76 #define MAYBE_TestThemeInstallUndoResetsToDefault DISABLED_TestThemeInstallUndoR
esetsToDefault | 76 #define MAYBE_TestThemeInstallUndoResetsToDefault DISABLED_TestThemeInstallUndoR
esetsToDefault |
77 #else | 77 #else |
78 #define MAYBE_TestThemeInstallUndoResetsToDefault TestThemeInstallUndoResetsToDe
fault | 78 #define MAYBE_TestThemeInstallUndoResetsToDefault TestThemeInstallUndoResetsToDe
fault |
79 #endif | 79 #endif |
80 | 80 |
81 IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, | 81 IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, |
82 MAYBE_TestThemeInstallUndoResetsToDefault) { | 82 MAYBE_TestThemeInstallUndoResetsToDefault) { |
83 #if defined(OS_WIN) && defined(USE_ASH) | 83 #if defined(OS_WIN) && defined(USE_ASH) |
84 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 84 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
85 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 85 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 86 switches::kAshBrowserTests)) |
86 return; | 87 return; |
87 #endif | 88 #endif |
88 | 89 |
89 // Install theme once and undo to verify we go back to default theme. | 90 // Install theme once and undo to verify we go back to default theme. |
90 base::FilePath theme_crx = PackExtension(test_data_dir_.AppendASCII("theme")); | 91 base::FilePath theme_crx = PackExtension(test_data_dir_.AppendASCII("theme")); |
91 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(theme_crx, 1, browser())); | 92 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(theme_crx, 1, browser())); |
92 const Extension* theme = GetTheme(); | 93 const Extension* theme = GetTheme(); |
93 ASSERT_TRUE(theme); | 94 ASSERT_TRUE(theme); |
94 std::string theme_id = theme->id(); | 95 std::string theme_id = theme->id(); |
95 VerifyThemeInfoBarAndUndoInstall(); | 96 VerifyThemeInfoBarAndUndoInstall(); |
96 ASSERT_EQ(NULL, GetTheme()); | 97 ASSERT_EQ(NULL, GetTheme()); |
97 | 98 |
98 // Set the same theme twice and undo to verify we go back to default theme. | 99 // Set the same theme twice and undo to verify we go back to default theme. |
99 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(theme_crx, 0, browser())); | 100 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(theme_crx, 0, browser())); |
100 theme = GetTheme(); | 101 theme = GetTheme(); |
101 ASSERT_TRUE(theme); | 102 ASSERT_TRUE(theme); |
102 ASSERT_EQ(theme_id, theme->id()); | 103 ASSERT_EQ(theme_id, theme->id()); |
103 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(theme_crx, 0, browser())); | 104 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(theme_crx, 0, browser())); |
104 theme = GetTheme(); | 105 theme = GetTheme(); |
105 ASSERT_TRUE(theme); | 106 ASSERT_TRUE(theme); |
106 ASSERT_EQ(theme_id, theme->id()); | 107 ASSERT_EQ(theme_id, theme->id()); |
107 VerifyThemeInfoBarAndUndoInstall(); | 108 VerifyThemeInfoBarAndUndoInstall(); |
108 ASSERT_EQ(NULL, GetTheme()); | 109 ASSERT_EQ(NULL, GetTheme()); |
109 } | 110 } |
110 | 111 |
111 IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, | 112 IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, |
112 TestThemeInstallUndoResetsToPreviousTheme) { | 113 TestThemeInstallUndoResetsToPreviousTheme) { |
113 #if defined(OS_WIN) && defined(USE_ASH) | 114 #if defined(OS_WIN) && defined(USE_ASH) |
114 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 115 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
115 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 116 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 117 switches::kAshBrowserTests)) |
116 return; | 118 return; |
117 #endif | 119 #endif |
118 | 120 |
119 // Install first theme. | 121 // Install first theme. |
120 InstallThemeAndVerify("theme", "camo theme"); | 122 InstallThemeAndVerify("theme", "camo theme"); |
121 const Extension* theme = GetTheme(); | 123 const Extension* theme = GetTheme(); |
122 std::string theme_id = theme->id(); | 124 std::string theme_id = theme->id(); |
123 | 125 |
124 // Then install second theme. | 126 // Then install second theme. |
125 InstallThemeAndVerify("theme2", "snowflake theme"); | 127 InstallThemeAndVerify("theme2", "snowflake theme"); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 sorting->OnExtensionMoved( | 246 sorting->OnExtensionMoved( |
245 app_id, std::string(), extensions::kWebStoreAppId); | 247 app_id, std::string(), extensions::kWebStoreAppId); |
246 EXPECT_EQ(app_id, last_reordered_extension_id_); | 248 EXPECT_EQ(app_id, last_reordered_extension_id_); |
247 | 249 |
248 // Now install the app. | 250 // Now install the app. |
249 const extensions::Extension* test_app = LoadExtension(app_dir); | 251 const extensions::Extension* test_app = LoadExtension(app_dir); |
250 ASSERT_TRUE(test_app); | 252 ASSERT_TRUE(test_app); |
251 EXPECT_TRUE(service->GetInstalledExtension(app_id)); | 253 EXPECT_TRUE(service->GetInstalledExtension(app_id)); |
252 EXPECT_EQ(app_id, test_app->id()); | 254 EXPECT_EQ(app_id, test_app->id()); |
253 } | 255 } |
OLD | NEW |