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

Side by Side Diff: chrome/browser/extensions/extension_install_ui_browsertest.cc

Issue 1220963005: Update base::StartsWith calls to new form (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@starts_with
Patch Set: Created 5 years, 5 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
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 "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
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(base::StartsWithASCII(web_contents->GetURL().spec(), 164 EXPECT_TRUE(base::StartsWith(web_contents->GetURL().spec(),
165 "chrome://newtab/", false)); 165 "chrome://newtab/",
166 base::CompareCase::INSENSITIVE_ASCII));
166 } else { 167 } else {
167 // TODO(xiyuan): Figure out how to test extension installed bubble? 168 // TODO(xiyuan): Figure out how to test extension installed bubble?
168 } 169 }
169 } 170 }
170 171
171 // TODO(samarth): remove along with NTP4 code. 172 // TODO(samarth): remove along with NTP4 code.
172 IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, 173 IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest,
173 DISABLED_AppInstallConfirmation_Incognito) { 174 DISABLED_AppInstallConfirmation_Incognito) {
174 Browser* incognito_browser = CreateIncognitoBrowser(); 175 Browser* incognito_browser = CreateIncognitoBrowser();
175 176
176 int num_incognito_tabs = incognito_browser->tab_strip_model()->count(); 177 int num_incognito_tabs = incognito_browser->tab_strip_model()->count();
177 int num_normal_tabs = browser()->tab_strip_model()->count(); 178 int num_normal_tabs = browser()->tab_strip_model()->count();
178 179
179 base::FilePath app_dir = test_data_dir_.AppendASCII("app"); 180 base::FilePath app_dir = test_data_dir_.AppendASCII("app");
180 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(app_dir, 1, 181 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(app_dir, 1,
181 incognito_browser)); 182 incognito_browser));
182 183
183 EXPECT_EQ(num_incognito_tabs, 184 EXPECT_EQ(num_incognito_tabs,
184 incognito_browser->tab_strip_model()->count()); 185 incognito_browser->tab_strip_model()->count());
185 if (NewTabUI::ShouldShowApps()) { 186 if (NewTabUI::ShouldShowApps()) {
186 EXPECT_EQ(num_normal_tabs + 1, browser()->tab_strip_model()->count()); 187 EXPECT_EQ(num_normal_tabs + 1, browser()->tab_strip_model()->count());
187 WebContents* web_contents = 188 WebContents* web_contents =
188 browser()->tab_strip_model()->GetActiveWebContents(); 189 browser()->tab_strip_model()->GetActiveWebContents();
189 ASSERT_TRUE(web_contents); 190 ASSERT_TRUE(web_contents);
190 EXPECT_TRUE(base::StartsWithASCII(web_contents->GetURL().spec(), 191 EXPECT_TRUE(base::StartsWith(web_contents->GetURL().spec(),
191 "chrome://newtab/", false)); 192 "chrome://newtab/",
193 base::CompareCase::INSENSITIVE_ASCII));
192 } else { 194 } else {
193 // TODO(xiyuan): Figure out how to test extension installed bubble? 195 // TODO(xiyuan): Figure out how to test extension installed bubble?
194 } 196 }
195 } 197 }
196 198
197 class NewTabUISortingBrowserTest : public ExtensionInstallUIBrowserTest, 199 class NewTabUISortingBrowserTest : public ExtensionInstallUIBrowserTest,
198 public content::NotificationObserver { 200 public content::NotificationObserver {
199 public: 201 public:
200 NewTabUISortingBrowserTest() {} 202 NewTabUISortingBrowserTest() {}
201 203
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 sorting->OnExtensionMoved( 248 sorting->OnExtensionMoved(
247 app_id, std::string(), extensions::kWebStoreAppId); 249 app_id, std::string(), extensions::kWebStoreAppId);
248 EXPECT_EQ(app_id, last_reordered_extension_id_); 250 EXPECT_EQ(app_id, last_reordered_extension_id_);
249 251
250 // Now install the app. 252 // Now install the app.
251 const extensions::Extension* test_app = LoadExtension(app_dir); 253 const extensions::Extension* test_app = LoadExtension(app_dir);
252 ASSERT_TRUE(test_app); 254 ASSERT_TRUE(test_app);
253 EXPECT_TRUE(service->GetInstalledExtension(app_id)); 255 EXPECT_TRUE(service->GetInstalledExtension(app_id));
254 EXPECT_EQ(app_id, test_app->id()); 256 EXPECT_EQ(app_id, test_app->id());
255 } 257 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698