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

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

Issue 8725013: Improve ExtensionBrowserTest. Part of moving ExtensionService to use ExtensionSet. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix tests 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
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 "base/stringprintf.h" 5 #include "base/stringprintf.h"
6 #include "chrome/browser/extensions/extension_browsertest.h" 6 #include "chrome/browser/extensions/extension_browsertest.h"
7 #include "chrome/browser/extensions/extension_function_test_utils.h" 7 #include "chrome/browser/extensions/extension_function_test_utils.h"
8 #include "chrome/browser/extensions/extension_install_dialog.h" 8 #include "chrome/browser/extensions/extension_install_dialog.h"
9 #include "chrome/browser/extensions/extension_management_api.h" 9 #include "chrome/browser/extensions/extension_management_api.h"
10 #include "chrome/browser/extensions/extension_management_api_constants.h" 10 #include "chrome/browser/extensions/extension_management_api_constants.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 virtual void SetUpOnMainThread() OVERRIDE { 64 virtual void SetUpOnMainThread() OVERRIDE {
65 ExtensionService* service = browser()->profile()->GetExtensionService(); 65 ExtensionService* service = browser()->profile()->GetExtensionService();
66 66
67 // Install low-permission version of the extension. 67 // Install low-permission version of the extension.
68 ASSERT_TRUE(InstallExtension( 68 ASSERT_TRUE(InstallExtension(
69 test_data_dir_.AppendASCII("permissions-low-v1.crx"), 1)); 69 test_data_dir_.AppendASCII("permissions-low-v1.crx"), 1));
70 EXPECT_TRUE(service->GetExtensionById(kId, false) != NULL); 70 EXPECT_TRUE(service->GetExtensionById(kId, false) != NULL);
71 71
72 // Update to a high-permission version - it should get disabled. 72 // Update to a high-permission version - it should get disabled.
73 EXPECT_TRUE(UpdateExtension( 73 EXPECT_FALSE(UpdateExtension(
74 kId, test_data_dir_.AppendASCII("permissions-high-v2.crx"), -1)); 74 kId, test_data_dir_.AppendASCII("permissions-high-v2.crx"), -1));
75 EXPECT_TRUE(service->GetExtensionById(kId, false) == NULL); 75 EXPECT_TRUE(service->GetExtensionById(kId, false) == NULL);
76 EXPECT_TRUE(service->GetExtensionById(kId, true) != NULL); 76 EXPECT_TRUE(service->GetExtensionById(kId, true) != NULL);
77 EXPECT_TRUE( 77 EXPECT_TRUE(
78 service->extension_prefs()->DidExtensionEscalatePermissions(kId)); 78 service->extension_prefs()->DidExtensionEscalatePermissions(kId));
79 } 79 }
80 80
81 void ReEnable(bool user_gesture, const std::string& expected_error) { 81 void ReEnable(bool user_gesture, const std::string& expected_error) {
82 scoped_refptr<SetEnabledFunction> function(new SetEnabledFunction); 82 scoped_refptr<SetEnabledFunction> function(new SetEnabledFunction);
83 if (user_gesture) 83 if (user_gesture)
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 ReEnable(false, keys::kGestureNeededForEscalationError); 121 ReEnable(false, keys::kGestureNeededForEscalationError);
122 122
123 // Expect an error that user cancelled the dialog. 123 // Expect an error that user cancelled the dialog.
124 SetExtensionInstallDialogAutoConfirmForTests(false); 124 SetExtensionInstallDialogAutoConfirmForTests(false);
125 ReEnable(true, keys::kUserDidNotReEnableError); 125 ReEnable(true, keys::kUserDidNotReEnableError);
126 126
127 // This should succeed when user accepts dialog. 127 // This should succeed when user accepts dialog.
128 SetExtensionInstallDialogAutoConfirmForTests(true); 128 SetExtensionInstallDialogAutoConfirmForTests(true);
129 ReEnable(true, ""); 129 ReEnable(true, "");
130 } 130 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_browsertest.cc ('k') | chrome/browser/extensions/extension_management_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698