| 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 fake_user_manager->AddKioskAppUser("example@example.com"); | 538 const AccountId account_id(AccountId::FromUserEmail("example@example.com")); |
| 539 fake_user_manager->LoginUser("example@example.com"); | 539 fake_user_manager->AddKioskAppUser(account_id); |
| 540 fake_user_manager->LoginUser(account_id); |
| 540 chromeos::ScopedUserManagerEnabler scoped_user_manager(fake_user_manager); | 541 chromeos::ScopedUserManagerEnabler scoped_user_manager(fake_user_manager); |
| 541 EXPECT_TRUE(InstallExtension(crx_path, 1)); | 542 EXPECT_TRUE(InstallExtension(crx_path, 1)); |
| 542 #endif | 543 #endif |
| 543 } | 544 } |
| 544 | 545 |
| 545 #if defined(OS_CHROMEOS) | 546 #if defined(OS_CHROMEOS) |
| 546 IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, InstallToSharedLocation) { | 547 IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, InstallToSharedLocation) { |
| 547 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 548 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 548 chromeos::switches::kEnableExtensionAssetsSharing); | 549 chromeos::switches::kEnableExtensionAssetsSharing); |
| 549 base::ScopedTempDir cache_dir; | 550 base::ScopedTempDir cache_dir; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 ManagementPolicyMock policy; | 592 ManagementPolicyMock policy; |
| 592 extensions::ExtensionSystem::Get(profile()) | 593 extensions::ExtensionSystem::Get(profile()) |
| 593 ->management_policy() | 594 ->management_policy() |
| 594 ->RegisterProvider(&policy); | 595 ->RegisterProvider(&policy); |
| 595 | 596 |
| 596 base::FilePath crx_path = test_data_dir_.AppendASCII("crx_installer/v1.crx"); | 597 base::FilePath crx_path = test_data_dir_.AppendASCII("crx_installer/v1.crx"); |
| 597 EXPECT_FALSE(InstallExtension(crx_path, 0)); | 598 EXPECT_FALSE(InstallExtension(crx_path, 0)); |
| 598 } | 599 } |
| 599 | 600 |
| 600 } // namespace extensions | 601 } // namespace extensions |
| OLD | NEW |