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/browser/extensions/extension_browsertest.h" | 6 #include "chrome/browser/extensions/extension_browsertest.h" |
7 #include "chrome/browser/extensions/extension_service.h" | 7 #include "chrome/browser/extensions/extension_service.h" |
8 #include "chrome/browser/extensions/theme_installed_infobar_delegate.h" | 8 #include "chrome/browser/extensions/theme_installed_infobar_delegate.h" |
9 #include "chrome/browser/infobars/infobar_tab_helper.h" | 9 #include "chrome/browser/infobars/infobar_tab_helper.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(theme_path2, 1, browser())); | 94 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(theme_path2, 1, browser())); |
95 const Extension* theme2 = GetTheme(); | 95 const Extension* theme2 = GetTheme(); |
96 ASSERT_TRUE(theme2); | 96 ASSERT_TRUE(theme2); |
97 EXPECT_FALSE(theme_id == theme2->id()); | 97 EXPECT_FALSE(theme_id == theme2->id()); |
98 | 98 |
99 // Undo second theme will revert to first theme. | 99 // Undo second theme will revert to first theme. |
100 VerifyThemeInfoBarAndUndoInstall(); | 100 VerifyThemeInfoBarAndUndoInstall(); |
101 EXPECT_EQ(theme, GetTheme()); | 101 EXPECT_EQ(theme, GetTheme()); |
102 } | 102 } |
103 | 103 |
| 104 #if defined(OS_WIN) |
| 105 // http://crbug.com/141854 |
| 106 #define MAYBE_AppInstallConfirmation FLAKY_AppInstallConfirmation |
| 107 #else |
| 108 #define MAYBE_AppInstallConfirmation AppInstallConfirmation |
| 109 #endif |
104 IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, | 110 IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, |
105 AppInstallConfirmation) { | 111 MAYBE_AppInstallConfirmation) { |
106 int num_tabs = browser()->tab_count(); | 112 int num_tabs = browser()->tab_count(); |
107 | 113 |
108 FilePath app_dir = test_data_dir_.AppendASCII("app"); | 114 FilePath app_dir = test_data_dir_.AppendASCII("app"); |
109 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(app_dir, 1, browser())); | 115 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(app_dir, 1, browser())); |
110 | 116 |
111 if (NewTabUI::ShouldShowApps()) { | 117 if (NewTabUI::ShouldShowApps()) { |
112 EXPECT_EQ(num_tabs + 1, browser()->tab_count()); | 118 EXPECT_EQ(num_tabs + 1, browser()->tab_count()); |
113 WebContents* web_contents = chrome::GetActiveWebContents(browser()); | 119 WebContents* web_contents = chrome::GetActiveWebContents(browser()); |
114 ASSERT_TRUE(web_contents); | 120 ASSERT_TRUE(web_contents); |
115 EXPECT_TRUE(StartsWithASCII(web_contents->GetURL().spec(), | 121 EXPECT_TRUE(StartsWithASCII(web_contents->GetURL().spec(), |
116 "chrome://newtab/", false)); | 122 "chrome://newtab/", false)); |
117 } else { | 123 } else { |
118 // TODO(xiyuan): Figure out how to test extension installed bubble? | 124 // TODO(xiyuan): Figure out how to test extension installed bubble? |
119 } | 125 } |
120 } | 126 } |
121 | 127 |
| 128 #if defined(OS_WIN) |
| 129 // http://crbug.com/141854 |
| 130 #define MAYBE_AppInstallConfirmation_Incognito \ |
| 131 FLAKY_AppInstallConfirmation_Incognito |
| 132 #else |
| 133 #define MAYBE_AppInstallConfirmation_Incognito AppInstallConfirmation_Incognito |
| 134 #endif |
122 IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, | 135 IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, |
123 AppInstallConfirmation_Incognito) { | 136 MAYBE_AppInstallConfirmation_Incognito) { |
124 Profile* incognito_profile = browser()->profile()->GetOffTheRecordProfile(); | 137 Profile* incognito_profile = browser()->profile()->GetOffTheRecordProfile(); |
125 Browser* incognito_browser = | 138 Browser* incognito_browser = |
126 new Browser(Browser::CreateParams(incognito_profile)); | 139 new Browser(Browser::CreateParams(incognito_profile)); |
127 | 140 |
128 int num_incognito_tabs = incognito_browser->tab_count(); | 141 int num_incognito_tabs = incognito_browser->tab_count(); |
129 int num_normal_tabs = browser()->tab_count(); | 142 int num_normal_tabs = browser()->tab_count(); |
130 | 143 |
131 FilePath app_dir = test_data_dir_.AppendASCII("app"); | 144 FilePath app_dir = test_data_dir_.AppendASCII("app"); |
132 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(app_dir, 1, | 145 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(app_dir, 1, |
133 incognito_browser)); | 146 incognito_browser)); |
134 | 147 |
135 EXPECT_EQ(num_incognito_tabs, incognito_browser->tab_count()); | 148 EXPECT_EQ(num_incognito_tabs, incognito_browser->tab_count()); |
136 if (NewTabUI::ShouldShowApps()) { | 149 if (NewTabUI::ShouldShowApps()) { |
137 EXPECT_EQ(num_normal_tabs + 1, browser()->tab_count()); | 150 EXPECT_EQ(num_normal_tabs + 1, browser()->tab_count()); |
138 WebContents* web_contents = chrome::GetActiveWebContents(browser()); | 151 WebContents* web_contents = chrome::GetActiveWebContents(browser()); |
139 ASSERT_TRUE(web_contents); | 152 ASSERT_TRUE(web_contents); |
140 EXPECT_TRUE(StartsWithASCII(web_contents->GetURL().spec(), | 153 EXPECT_TRUE(StartsWithASCII(web_contents->GetURL().spec(), |
141 "chrome://newtab/", false)); | 154 "chrome://newtab/", false)); |
142 } else { | 155 } else { |
143 // TODO(xiyuan): Figure out how to test extension installed bubble? | 156 // TODO(xiyuan): Figure out how to test extension installed bubble? |
144 } | 157 } |
145 } | 158 } |
OLD | NEW |