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

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

Issue 25366003: Moved some functions off ExtensionService into a new file extension_util. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Windows compile 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 "chrome/browser/chrome_notification_types.h" 5 #include "chrome/browser/chrome_notification_types.h"
6 #include "chrome/browser/extensions/crx_installer.h" 6 #include "chrome/browser/extensions/crx_installer.h"
7 #include "chrome/browser/extensions/extension_browsertest.h" 7 #include "chrome/browser/extensions/extension_browsertest.h"
8 #include "chrome/browser/extensions/extension_service.h" 8 #include "chrome/browser/extensions/extension_service.h"
9 #include "chrome/browser/extensions/extension_util.h"
9 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/browser_commands.h" 11 #include "chrome/browser/ui/browser_commands.h"
11 #include "chrome/test/base/ui_test_utils.h" 12 #include "chrome/test/base/ui_test_utils.h"
12 #include "content/public/browser/notification_service.h" 13 #include "content/public/browser/notification_service.h"
13 14
14 namespace extensions { 15 namespace extensions {
15 16
16 class ExtensionFunctionalTest : public ExtensionBrowserTest { 17 class ExtensionFunctionalTest : public ExtensionBrowserTest {
17 public: 18 public:
18 void InstallExtensionSilently(ExtensionService* service, 19 void InstallExtensionSilently(ExtensionService* service,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 PRE_TestAdblockExtensionCrash) { 59 PRE_TestAdblockExtensionCrash) {
59 ExtensionService* service = profile()->GetExtensionService(); 60 ExtensionService* service = profile()->GetExtensionService();
60 InstallExtensionSilently(service, "adblock.crx"); 61 InstallExtensionSilently(service, "adblock.crx");
61 } 62 }
62 63
63 IN_PROC_BROWSER_TEST_F(ExtensionFunctionalTest, TestAdblockExtensionCrash) { 64 IN_PROC_BROWSER_TEST_F(ExtensionFunctionalTest, TestAdblockExtensionCrash) {
64 ExtensionService* service = profile()->GetExtensionService(); 65 ExtensionService* service = profile()->GetExtensionService();
65 // Verify that the extension is enabled and allowed in incognito 66 // Verify that the extension is enabled and allowed in incognito
66 // is disabled. 67 // is disabled.
67 EXPECT_TRUE(service->IsExtensionEnabled(last_loaded_extension_id_)); 68 EXPECT_TRUE(service->IsExtensionEnabled(last_loaded_extension_id_));
68 EXPECT_FALSE(service->IsIncognitoEnabled(last_loaded_extension_id_)); 69 EXPECT_FALSE(extension_util::IsIncognitoEnabled(last_loaded_extension_id_,
70 service));
69 } 71 }
70 72
71 IN_PROC_BROWSER_TEST_F(ExtensionFunctionalTest, TestSetExtensionsState) { 73 IN_PROC_BROWSER_TEST_F(ExtensionFunctionalTest, TestSetExtensionsState) {
72 ExtensionService* service = profile()->GetExtensionService(); 74 ExtensionService* service = profile()->GetExtensionService();
73 InstallExtensionSilently(service, "google_talk.crx"); 75 InstallExtensionSilently(service, "google_talk.crx");
74 76
75 // Disable the extension and verify. 77 // Disable the extension and verify.
76 service->SetIsIncognitoEnabled(last_loaded_extension_id_, false); 78 extension_util::SetIsIncognitoEnabled(
79 last_loaded_extension_id_, service, false);
77 service->DisableExtension(last_loaded_extension_id_, 80 service->DisableExtension(last_loaded_extension_id_,
78 Extension::DISABLE_USER_ACTION); 81 Extension::DISABLE_USER_ACTION);
79 EXPECT_FALSE(service->IsExtensionEnabled(last_loaded_extension_id_)); 82 EXPECT_FALSE(service->IsExtensionEnabled(last_loaded_extension_id_));
80 83
81 // Enable the extension and verify. 84 // Enable the extension and verify.
82 service->SetIsIncognitoEnabled(last_loaded_extension_id_, false); 85 extension_util::SetIsIncognitoEnabled(
86 last_loaded_extension_id_, service, false);
83 service->EnableExtension(last_loaded_extension_id_); 87 service->EnableExtension(last_loaded_extension_id_);
84 EXPECT_TRUE(service->IsExtensionEnabled(last_loaded_extension_id_)); 88 EXPECT_TRUE(service->IsExtensionEnabled(last_loaded_extension_id_));
85 89
86 // Allow extension in incognito mode and verify. 90 // Allow extension in incognito mode and verify.
87 service->EnableExtension(last_loaded_extension_id_); 91 service->EnableExtension(last_loaded_extension_id_);
88 service->SetIsIncognitoEnabled(last_loaded_extension_id_, true); 92 extension_util::SetIsIncognitoEnabled(
89 EXPECT_TRUE(service->IsIncognitoEnabled(last_loaded_extension_id_)); 93 last_loaded_extension_id_, service, true);
94 EXPECT_TRUE(extension_util::IsIncognitoEnabled(last_loaded_extension_id_,
95 service));
90 96
91 // Disallow extension in incognito mode and verify. 97 // Disallow extension in incognito mode and verify.
92 service->EnableExtension(last_loaded_extension_id_); 98 service->EnableExtension(last_loaded_extension_id_);
93 service->SetIsIncognitoEnabled(last_loaded_extension_id_, false); 99 extension_util::SetIsIncognitoEnabled(
94 EXPECT_FALSE(service->IsIncognitoEnabled(last_loaded_extension_id_)); 100 last_loaded_extension_id_, service, false);
101 EXPECT_FALSE(extension_util::IsIncognitoEnabled(last_loaded_extension_id_,
102 service));
95 } 103 }
96 } // namespace extensions 104 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698