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 28 matching lines...) Expand all Loading... |
39 #include "extensions/common/extension.h" | 39 #include "extensions/common/extension.h" |
40 #include "extensions/common/feature_switch.h" | 40 #include "extensions/common/feature_switch.h" |
41 #include "extensions/common/file_util.h" | 41 #include "extensions/common/file_util.h" |
42 #include "extensions/common/permissions/api_permission.h" | 42 #include "extensions/common/permissions/api_permission.h" |
43 #include "extensions/common/permissions/permission_set.h" | 43 #include "extensions/common/permissions/permission_set.h" |
44 #include "extensions/common/permissions/permissions_data.h" | 44 #include "extensions/common/permissions/permissions_data.h" |
45 #include "extensions/common/switches.h" | 45 #include "extensions/common/switches.h" |
46 #include "ui/base/l10n/l10n_util.h" | 46 #include "ui/base/l10n/l10n_util.h" |
47 | 47 |
48 #if defined(OS_CHROMEOS) | 48 #if defined(OS_CHROMEOS) |
49 #include "chrome/browser/chromeos/login/users/fake_user_manager.h" | 49 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" |
50 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" | 50 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" |
51 #include "chrome/browser/extensions/extension_assets_manager_chromeos.h" | 51 #include "chrome/browser/extensions/extension_assets_manager_chromeos.h" |
52 #include "chromeos/chromeos_switches.h" | 52 #include "chromeos/chromeos_switches.h" |
53 #endif | 53 #endif |
54 | 54 |
55 class SkBitmap; | 55 class SkBitmap; |
56 | 56 |
57 namespace extensions { | 57 namespace extensions { |
58 | 58 |
59 namespace { | 59 namespace { |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 EXPECT_TRUE(mock_prompt->did_succeed()); | 526 EXPECT_TRUE(mock_prompt->did_succeed()); |
527 } | 527 } |
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::FakeUserManager* fake_user_manager = | 536 chromeos::FakeChromeUserManager* fake_user_manager = |
537 new chromeos::FakeUserManager(); | 537 new chromeos::FakeChromeUserManager(); |
538 fake_user_manager->AddKioskAppUser("example@example.com"); | 538 fake_user_manager->AddKioskAppUser("example@example.com"); |
539 fake_user_manager->LoginUser("example@example.com"); | 539 fake_user_manager->LoginUser("example@example.com"); |
540 chromeos::ScopedUserManagerEnabler scoped_user_manager(fake_user_manager); | 540 chromeos::ScopedUserManagerEnabler scoped_user_manager(fake_user_manager); |
541 EXPECT_TRUE(InstallExtension(crx_path, 1)); | 541 EXPECT_TRUE(InstallExtension(crx_path, 1)); |
542 #endif | 542 #endif |
543 } | 543 } |
544 | 544 |
545 #if defined(OS_CHROMEOS) | 545 #if defined(OS_CHROMEOS) |
546 IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, InstallToSharedLocation) { | 546 IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, InstallToSharedLocation) { |
547 base::ShadowingAtExitManager at_exit_manager; | 547 base::ShadowingAtExitManager at_exit_manager; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 // because previously withheld permissions are now being requested. | 630 // because previously withheld permissions are now being requested. |
631 enable_scripts_switch.reset(); | 631 enable_scripts_switch.reset(); |
632 extension = InstallExtension(crx_path, -1); | 632 extension = InstallExtension(crx_path, -1); |
633 EXPECT_FALSE(registry->enabled_extensions().GetByID(extension_id)); | 633 EXPECT_FALSE(registry->enabled_extensions().GetByID(extension_id)); |
634 EXPECT_TRUE(registry->disabled_extensions().GetByID(extension_id)); | 634 EXPECT_TRUE(registry->disabled_extensions().GetByID(extension_id)); |
635 EXPECT_TRUE(ExtensionPrefs::Get(browser()->profile())->GetDisableReasons( | 635 EXPECT_TRUE(ExtensionPrefs::Get(browser()->profile())->GetDisableReasons( |
636 extension_id) & Extension::DISABLE_PERMISSIONS_INCREASE); | 636 extension_id) & Extension::DISABLE_PERMISSIONS_INCREASE); |
637 } | 637 } |
638 | 638 |
639 } // namespace extensions | 639 } // namespace extensions |
OLD | NEW |