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

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

Issue 23868042: Mark supervised profiles as such immediately when they're created. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 3 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 | Annotate | Revision Log
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/stringprintf.h" 6 #include "base/strings/stringprintf.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/chrome_notification_types.h" 8 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/extensions/extension_host.h" 9 #include "chrome/browser/extensions/extension_host.h"
10 #include "chrome/browser/extensions/extension_install_ui.h" 10 #include "chrome/browser/extensions/extension_install_ui.h"
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 extension_service->AddExtension(hosted_app.get()); 228 extension_service->AddExtension(hosted_app.get());
229 EXPECT_TRUE(extension_service->extensions()->Contains(hosted_app->id())); 229 EXPECT_TRUE(extension_service->extensions()->Contains(hosted_app->id()));
230 230
231 ui_test_utils::NavigateToURL(browser(), kInstallUrl); 231 ui_test_utils::NavigateToURL(browser(), kInstallUrl);
232 232
233 EXPECT_FALSE(extension_service->extensions()->Contains(kTestExtensionId)); 233 EXPECT_FALSE(extension_service->extensions()->Contains(kTestExtensionId));
234 RunTest("runTest"); 234 RunTest("runTest");
235 EXPECT_TRUE(extension_service->extensions()->Contains(kTestExtensionId)); 235 EXPECT_TRUE(extension_service->extensions()->Contains(kTestExtensionId));
236 } 236 }
237 237
238 IN_PROC_BROWSER_TEST_F(WebstoreStartupInstallerTest, 238 class WebstoreStartupInstallerManagedUsersTest
239 InstallProhibitedForManagedUsers) { 239 : public WebstoreStartupInstallerTest {
240 public:
241 // InProcessBrowserTest overrides:
242 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
243 WebstoreStartupInstallerTest::SetUpCommandLine(command_line);
244 command_line->AppendSwitch(switches::kNewProfileIsSupervised);
245 }
246 };
247
248 IN_PROC_BROWSER_TEST_F(WebstoreStartupInstallerManagedUsersTest,
249 InstallProhibited) {
240 #if defined(OS_WIN) && defined(USE_ASH) 250 #if defined(OS_WIN) && defined(USE_ASH)
241 // Disable this test in Metro+Ash for now (http://crbug.com/262796). 251 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
242 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) 252 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests))
243 return; 253 return;
244 #endif 254 #endif
245 255
246 CommandLine::ForCurrentProcess()->AppendSwitchASCII( 256 CommandLine::ForCurrentProcess()->AppendSwitchASCII(
247 switches::kAppsGalleryInstallAutoConfirmForTests, "accept"); 257 switches::kAppsGalleryInstallAutoConfirmForTests, "accept");
248 258
249 // Make the profile managed such that no extension installs are allowed.
250 ManagedUserService* service =
251 ManagedUserServiceFactory::GetForProfile(browser()->profile());
252 service->InitForTesting();
253
254 ui_test_utils::NavigateToURL( 259 ui_test_utils::NavigateToURL(
255 browser(), GenerateTestServerUrl(kAppDomain, "install_prohibited.html")); 260 browser(), GenerateTestServerUrl(kAppDomain, "install_prohibited.html"));
256 261
257 RunTest("runTest"); 262 RunTest("runTest");
258 263
259 // No error infobar should show up. 264 // No error infobar should show up.
260 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); 265 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents();
261 InfoBarService* info_bar_service = InfoBarService::FromWebContents(contents); 266 InfoBarService* info_bar_service = InfoBarService::FromWebContents(contents);
262 EXPECT_EQ(info_bar_service->infobar_count(), 0u); 267 EXPECT_EQ(info_bar_service->infobar_count(), 0u);
263 } 268 }
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 CommandLine* command_line = CommandLine::ForCurrentProcess(); 388 CommandLine* command_line = CommandLine::ForCurrentProcess();
384 command_line->AppendSwitchASCII( 389 command_line->AppendSwitchASCII(
385 switches::kLimitedInstallFromWebstore, "2"); 390 switches::kLimitedInstallFromWebstore, "2");
386 helper.LimitedInstallFromWebstore(*command_line, browser()->profile(), 391 helper.LimitedInstallFromWebstore(*command_line, browser()->profile(),
387 base::MessageLoop::QuitWhenIdleClosure()); 392 base::MessageLoop::QuitWhenIdleClosure());
388 base::MessageLoop::current()->Run(); 393 base::MessageLoop::current()->Run();
389 394
390 EXPECT_TRUE(saw_install()); 395 EXPECT_TRUE(saw_install());
391 EXPECT_EQ(0, browser_open_count()); 396 EXPECT_EQ(0, browser_open_count());
392 } 397 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698