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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 int num_tabs = browser()->tab_strip_model()->count(); | 154 int num_tabs = browser()->tab_strip_model()->count(); |
155 | 155 |
156 base::FilePath app_dir = test_data_dir_.AppendASCII("app"); | 156 base::FilePath app_dir = test_data_dir_.AppendASCII("app"); |
157 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(app_dir, 1, browser())); | 157 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(app_dir, 1, browser())); |
158 | 158 |
159 if (NewTabUI::ShouldShowApps()) { | 159 if (NewTabUI::ShouldShowApps()) { |
160 EXPECT_EQ(num_tabs + 1, browser()->tab_strip_model()->count()); | 160 EXPECT_EQ(num_tabs + 1, browser()->tab_strip_model()->count()); |
161 WebContents* web_contents = | 161 WebContents* web_contents = |
162 browser()->tab_strip_model()->GetActiveWebContents(); | 162 browser()->tab_strip_model()->GetActiveWebContents(); |
163 ASSERT_TRUE(web_contents); | 163 ASSERT_TRUE(web_contents); |
164 EXPECT_TRUE(StartsWithASCII(web_contents->GetURL().spec(), | 164 EXPECT_TRUE(base::StartsWithASCII(web_contents->GetURL().spec(), |
165 "chrome://newtab/", false)); | 165 "chrome://newtab/", false)); |
166 } else { | 166 } else { |
167 // TODO(xiyuan): Figure out how to test extension installed bubble? | 167 // TODO(xiyuan): Figure out how to test extension installed bubble? |
168 } | 168 } |
169 } | 169 } |
170 | 170 |
171 // TODO(samarth): remove along with NTP4 code. | 171 // TODO(samarth): remove along with NTP4 code. |
172 IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, | 172 IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, |
173 DISABLED_AppInstallConfirmation_Incognito) { | 173 DISABLED_AppInstallConfirmation_Incognito) { |
174 Browser* incognito_browser = CreateIncognitoBrowser(); | 174 Browser* incognito_browser = CreateIncognitoBrowser(); |
175 | 175 |
176 int num_incognito_tabs = incognito_browser->tab_strip_model()->count(); | 176 int num_incognito_tabs = incognito_browser->tab_strip_model()->count(); |
177 int num_normal_tabs = browser()->tab_strip_model()->count(); | 177 int num_normal_tabs = browser()->tab_strip_model()->count(); |
178 | 178 |
179 base::FilePath app_dir = test_data_dir_.AppendASCII("app"); | 179 base::FilePath app_dir = test_data_dir_.AppendASCII("app"); |
180 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(app_dir, 1, | 180 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(app_dir, 1, |
181 incognito_browser)); | 181 incognito_browser)); |
182 | 182 |
183 EXPECT_EQ(num_incognito_tabs, | 183 EXPECT_EQ(num_incognito_tabs, |
184 incognito_browser->tab_strip_model()->count()); | 184 incognito_browser->tab_strip_model()->count()); |
185 if (NewTabUI::ShouldShowApps()) { | 185 if (NewTabUI::ShouldShowApps()) { |
186 EXPECT_EQ(num_normal_tabs + 1, browser()->tab_strip_model()->count()); | 186 EXPECT_EQ(num_normal_tabs + 1, browser()->tab_strip_model()->count()); |
187 WebContents* web_contents = | 187 WebContents* web_contents = |
188 browser()->tab_strip_model()->GetActiveWebContents(); | 188 browser()->tab_strip_model()->GetActiveWebContents(); |
189 ASSERT_TRUE(web_contents); | 189 ASSERT_TRUE(web_contents); |
190 EXPECT_TRUE(StartsWithASCII(web_contents->GetURL().spec(), | 190 EXPECT_TRUE(base::StartsWithASCII(web_contents->GetURL().spec(), |
191 "chrome://newtab/", false)); | 191 "chrome://newtab/", false)); |
192 } else { | 192 } else { |
193 // TODO(xiyuan): Figure out how to test extension installed bubble? | 193 // TODO(xiyuan): Figure out how to test extension installed bubble? |
194 } | 194 } |
195 } | 195 } |
196 | 196 |
197 class NewTabUISortingBrowserTest : public ExtensionInstallUIBrowserTest, | 197 class NewTabUISortingBrowserTest : public ExtensionInstallUIBrowserTest, |
198 public content::NotificationObserver { | 198 public content::NotificationObserver { |
199 public: | 199 public: |
200 NewTabUISortingBrowserTest() {} | 200 NewTabUISortingBrowserTest() {} |
201 | 201 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 sorting->OnExtensionMoved( | 246 sorting->OnExtensionMoved( |
247 app_id, std::string(), extensions::kWebStoreAppId); | 247 app_id, std::string(), extensions::kWebStoreAppId); |
248 EXPECT_EQ(app_id, last_reordered_extension_id_); | 248 EXPECT_EQ(app_id, last_reordered_extension_id_); |
249 | 249 |
250 // Now install the app. | 250 // Now install the app. |
251 const extensions::Extension* test_app = LoadExtension(app_dir); | 251 const extensions::Extension* test_app = LoadExtension(app_dir); |
252 ASSERT_TRUE(test_app); | 252 ASSERT_TRUE(test_app); |
253 EXPECT_TRUE(service->GetInstalledExtension(app_id)); | 253 EXPECT_TRUE(service->GetInstalledExtension(app_id)); |
254 EXPECT_EQ(app_id, test_app->id()); | 254 EXPECT_EQ(app_id, test_app->id()); |
255 } | 255 } |
OLD | NEW |