| 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 "chrome/browser/extensions/crx_installer.h" | 5 #include "chrome/browser/extensions/crx_installer.h" |
| 6 | 6 |
| 7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 | 528 |
| 529 IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, KioskOnlyTest) { | 529 IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, KioskOnlyTest) { |
| 530 base::FilePath crx_path = | 530 base::FilePath crx_path = |
| 531 test_data_dir_.AppendASCII("kiosk/kiosk_only.crx"); | 531 test_data_dir_.AppendASCII("kiosk/kiosk_only.crx"); |
| 532 EXPECT_FALSE(InstallExtension(crx_path, 0)); | 532 EXPECT_FALSE(InstallExtension(crx_path, 0)); |
| 533 #if defined(OS_CHROMEOS) | 533 #if defined(OS_CHROMEOS) |
| 534 // Simulate ChromeOS kiosk mode. |scoped_user_manager| will take over | 534 // Simulate ChromeOS kiosk mode. |scoped_user_manager| will take over |
| 535 // lifetime of |user_manager|. | 535 // lifetime of |user_manager|. |
| 536 chromeos::FakeChromeUserManager* fake_user_manager = | 536 chromeos::FakeChromeUserManager* fake_user_manager = |
| 537 new chromeos::FakeChromeUserManager(); | 537 new chromeos::FakeChromeUserManager(); |
| 538 const AccountId account_id(AccountId::FromUserEmail("example@example.com")); | 538 fake_user_manager->AddKioskAppUser("example@example.com"); |
| 539 fake_user_manager->AddKioskAppUser(account_id); | 539 fake_user_manager->LoginUser("example@example.com"); |
| 540 fake_user_manager->LoginUser(account_id); | |
| 541 chromeos::ScopedUserManagerEnabler scoped_user_manager(fake_user_manager); | 540 chromeos::ScopedUserManagerEnabler scoped_user_manager(fake_user_manager); |
| 542 EXPECT_TRUE(InstallExtension(crx_path, 1)); | 541 EXPECT_TRUE(InstallExtension(crx_path, 1)); |
| 543 #endif | 542 #endif |
| 544 } | 543 } |
| 545 | 544 |
| 546 #if defined(OS_CHROMEOS) | 545 #if defined(OS_CHROMEOS) |
| 547 IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, InstallToSharedLocation) { | 546 IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, InstallToSharedLocation) { |
| 548 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 547 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 549 chromeos::switches::kEnableExtensionAssetsSharing); | 548 chromeos::switches::kEnableExtensionAssetsSharing); |
| 550 base::ScopedTempDir cache_dir; | 549 base::ScopedTempDir cache_dir; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 ManagementPolicyMock policy; | 591 ManagementPolicyMock policy; |
| 593 extensions::ExtensionSystem::Get(profile()) | 592 extensions::ExtensionSystem::Get(profile()) |
| 594 ->management_policy() | 593 ->management_policy() |
| 595 ->RegisterProvider(&policy); | 594 ->RegisterProvider(&policy); |
| 596 | 595 |
| 597 base::FilePath crx_path = test_data_dir_.AppendASCII("crx_installer/v1.crx"); | 596 base::FilePath crx_path = test_data_dir_.AppendASCII("crx_installer/v1.crx"); |
| 598 EXPECT_FALSE(InstallExtension(crx_path, 0)); | 597 EXPECT_FALSE(InstallExtension(crx_path, 0)); |
| 599 } | 598 } |
| 600 | 599 |
| 601 } // namespace extensions | 600 } // namespace extensions |
| OLD | NEW |