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

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

Issue 23604068: Add "kiosk_only" manifest attribute for platform apps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix kioskOnly key name. Created 7 years, 2 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/memory/ref_counted.h" 5 #include "base/memory/ref_counted.h"
6 #include "chrome/browser/download/download_crx_util.h" 6 #include "chrome/browser/download/download_crx_util.h"
7 #include "chrome/browser/extensions/crx_installer.h" 7 #include "chrome/browser/extensions/crx_installer.h"
8 #include "chrome/browser/extensions/extension_browsertest.h" 8 #include "chrome/browser/extensions/extension_browsertest.h"
9 #include "chrome/browser/extensions/extension_install_prompt.h" 9 #include "chrome/browser/extensions/extension_install_prompt.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
11 #include "chrome/browser/extensions/extension_system.h" 11 #include "chrome/browser/extensions/extension_system.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
14 #include "chrome/browser/ui/browser_window.h" 14 #include "chrome/browser/ui/browser_window.h"
15 #include "chrome/browser/ui/tabs/tab_strip_model.h" 15 #include "chrome/browser/ui/tabs/tab_strip_model.h"
16 #include "chrome/common/extensions/extension.h" 16 #include "chrome/common/extensions/extension.h"
17 #include "chrome/common/extensions/extension_file_util.h" 17 #include "chrome/common/extensions/extension_file_util.h"
18 #include "chrome/common/extensions/feature_switch.h" 18 #include "chrome/common/extensions/feature_switch.h"
19 #include "chrome/common/extensions/permissions/permission_set.h" 19 #include "chrome/common/extensions/permissions/permission_set.h"
20 #include "chrome/test/base/ui_test_utils.h" 20 #include "chrome/test/base/ui_test_utils.h"
21 #include "content/public/browser/download_manager.h" 21 #include "content/public/browser/download_manager.h"
22 #include "content/public/test/download_test_observer.h" 22 #include "content/public/test/download_test_observer.h"
23 #include "extensions/common/switches.h" 23 #include "extensions/common/switches.h"
24 #include "grit/generated_resources.h" 24 #include "grit/generated_resources.h"
25 #include "ui/base/l10n/l10n_util.h" 25 #include "ui/base/l10n/l10n_util.h"
26 26
27 #if defined(OS_CHROMEOS)
28 #include "chrome/browser/chromeos/login/fake_user_manager.h"
29 #include "chrome/browser/chromeos/login/user_manager.h"
xiyuan 2013/09/24 20:20:40 nit: only fake_user_manager.h is needed.
Tim Song 2013/09/24 21:07:26 We should include user_manager.h for explicit defi
30 #endif
31
27 class SkBitmap; 32 class SkBitmap;
28 33
29 namespace extensions { 34 namespace extensions {
30 35
31 namespace { 36 namespace {
32 37
33 class MockInstallPrompt; 38 class MockInstallPrompt;
34 39
35 // This class holds information about things that happen with a 40 // This class holds information about things that happen with a
36 // MockInstallPrompt. We create the MockInstallPrompt but need to pass 41 // MockInstallPrompt. We create the MockInstallPrompt but need to pass
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 std::string id = "lhnaeclnpobnlbjbgogdanmhadigfnjp"; 476 std::string id = "lhnaeclnpobnlbjbgogdanmhadigfnjp";
472 scoped_ptr<WebstoreInstaller::Approval> approval = 477 scoped_ptr<WebstoreInstaller::Approval> approval =
473 GetApproval("crx_installer/v2_no_permission_change/", id, false); 478 GetApproval("crx_installer/v2_no_permission_change/", id, false);
474 479
475 RunCrxInstaller(approval.get(), mock_prompt->CreatePrompt(), 480 RunCrxInstaller(approval.get(), mock_prompt->CreatePrompt(),
476 test_data_dir_.AppendASCII("crx_installer/v1.crx")); 481 test_data_dir_.AppendASCII("crx_installer/v1.crx"));
477 482
478 EXPECT_TRUE(mock_prompt->did_succeed()); 483 EXPECT_TRUE(mock_prompt->did_succeed());
479 } 484 }
480 485
486 IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, KioskOnlyTest) {
487 base::FilePath crx_path =
488 test_data_dir_.AppendASCII("kiosk/kiosk_only.crx");
489 EXPECT_FALSE(InstallExtension(crx_path, 0));
490 #if defined(OS_CHROMEOS)
491 // Simulate ChromeOS kiosk mode. |scoped_user_manager| will take over
492 // lifetime of |user_manager|.
493 chromeos::FakeUserManager* fake_user_manager =
494 new chromeos::FakeUserManager();
495 fake_user_manager->AddKioskAppUser("example@example.com");
496 fake_user_manager->UserLoggedIn("example@example.com");
497 chromeos::ScopedUserManagerEnabler scoped_user_manager(fake_user_manager);
498 EXPECT_TRUE(InstallExtension(crx_path, 1));
499 #endif
500 }
501
481 } // namespace extensions 502 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698