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

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

Issue 8741004: Fix broken ExtensionCrxInstallerTest.GalleryInstallGetsExperimental test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments Created 9 years 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
« no previous file with comments | « no previous file | chrome/test/data/extensions/experimental.crx » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "chrome/browser/extensions/extension_browsertest.h" 6 #include "chrome/browser/extensions/extension_browsertest.h"
7 #include "chrome/browser/extensions/extension_install_ui.h" 7 #include "chrome/browser/extensions/extension_install_ui.h"
8 #include "chrome/browser/extensions/extension_service.h" 8 #include "chrome/browser/extensions/extension_service.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
11 #include "chrome/common/chrome_switches.h"
11 #include "chrome/test/base/ui_test_utils.h" 12 #include "chrome/test/base/ui_test_utils.h"
12 13
13 class SkBitmap; 14 class SkBitmap;
14 15
15 namespace { 16 namespace {
16 17
17 class MockInstallUI : public ExtensionInstallUI { 18 class MockInstallUI : public ExtensionInstallUI {
18 public: 19 public:
19 explicit MockInstallUI(Profile* profile) : 20 explicit MockInstallUI(Profile* profile) :
20 ExtensionInstallUI(profile), confirmation_requested_(false) {} 21 ExtensionInstallUI(profile), confirmation_requested_(false) {}
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, Whitelisting) { 71 IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, Whitelisting) {
71 #if !defined(OS_CHROMEOS) 72 #if !defined(OS_CHROMEOS)
72 // An extension with NPAPI should give a prompt. 73 // An extension with NPAPI should give a prompt.
73 EXPECT_TRUE(DidWhitelistInstallPrompt("uitest/plugins.crx", 74 EXPECT_TRUE(DidWhitelistInstallPrompt("uitest/plugins.crx",
74 "hdgllgikmikobbofgnabhfimcfoopgnd")); 75 "hdgllgikmikobbofgnabhfimcfoopgnd"));
75 #endif // !defined(OS_CHROMEOS) 76 #endif // !defined(OS_CHROMEOS)
76 } 77 }
77 78
78 // crbug.com/105728: Fails because the CRX is invalid. 79 // crbug.com/105728: Fails because the CRX is invalid.
79 IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, 80 IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest,
80 FAILS_GalleryInstallGetsExperimental) { 81 GalleryInstallGetsExperimental) {
81 ASSERT_FALSE(InstallExtension( 82 // We must modify the command line temporarily in order to pack an extension
82 test_data_dir_.AppendASCII("experimental.crx"), 0)); 83 // that requests the experimental permission.
83 ASSERT_TRUE(InstallExtensionFromWebstore( 84 CommandLine* command_line = CommandLine::ForCurrentProcess();
84 test_data_dir_.AppendASCII("experimental.crx"), 1)); 85 CommandLine old_command_line = *command_line;
86 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis);
87 FilePath crx_path = PackExtension(
88 test_data_dir_.AppendASCII("experimental"));
89 ASSERT_FALSE(crx_path.empty());
90
91 // Now reset the command line so that we are testing specifically whether
92 // installing from webstore enables experimental permissions.
93 *(CommandLine::ForCurrentProcess()) = old_command_line;
94
95 EXPECT_FALSE(InstallExtension(crx_path, 0));
96 EXPECT_TRUE(InstallExtensionFromWebstore(crx_path, 1));
85 } 97 }
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/extensions/experimental.crx » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698