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

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

Issue 1415683010: cleanup/Remove deprecated notification from extension_functional_browsertest.cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « AUTHORS ('k') | no next file » | 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) 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 #include "chrome/browser/extensions/extension_browsertest.h" 6 #include "chrome/browser/extensions/extension_browsertest.h"
7 #include "chrome/browser/extensions/extension_service.h" 7 #include "chrome/browser/extensions/extension_service.h"
8 #include "chrome/browser/extensions/extension_util.h" 8 #include "chrome/browser/extensions/extension_util.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/browser_commands.h" 10 #include "chrome/browser/ui/browser_commands.h"
11 #include "content/public/browser/notification_service.h" 11 #include "content/public/browser/notification_service.h"
12 #include "content/public/test/test_utils.h" 12 #include "content/public/test/test_utils.h"
13 #include "extensions/browser/extension_registry.h" 13 #include "extensions/browser/extension_registry.h"
14 #include "extensions/browser/extension_system.h" 14 #include "extensions/browser/extension_system.h"
15 #include "extensions/browser/notification_types.h" 15 #include "extensions/browser/notification_types.h"
16 #include "extensions/browser/test_extension_registry_observer.h"
16 17
17 namespace extensions { 18 namespace extensions {
18 19
19 class ExtensionFunctionalTest : public ExtensionBrowserTest { 20 class ExtensionFunctionalTest : public ExtensionBrowserTest {
20 public: 21 public:
21 void InstallExtensionSilently(ExtensionService* service, 22 void InstallExtensionSilently(ExtensionService* service,
22 const char* filename) { 23 const char* filename) {
23 service->set_show_extensions_prompts(false); 24 service->set_show_extensions_prompts(false);
24 ExtensionRegistry* registry = ExtensionRegistry::Get(profile()); 25 ExtensionRegistry* registry = ExtensionRegistry::Get(profile());
25 size_t num_before = registry->enabled_extensions().size(); 26 size_t num_before = registry->enabled_extensions().size();
26 27
27 base::FilePath path = test_data_dir_.AppendASCII(filename); 28 base::FilePath path = test_data_dir_.AppendASCII(filename);
28 29
29 content::WindowedNotificationObserver extension_loaded_observer( 30 extensions::TestExtensionRegistryObserver extension_observer(registry);
30 extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED,
31 content::NotificationService::AllSources());
32 31
33 scoped_refptr<extensions::CrxInstaller> installer( 32 scoped_refptr<extensions::CrxInstaller> installer(
34 extensions::CrxInstaller::CreateSilent(service)); 33 extensions::CrxInstaller::CreateSilent(service));
35 installer->set_is_gallery_install(false); 34 installer->set_is_gallery_install(false);
36 installer->set_allow_silent_install(true); 35 installer->set_allow_silent_install(true);
37 installer->set_install_source(Manifest::INTERNAL); 36 installer->set_install_source(Manifest::INTERNAL);
38 installer->set_off_store_install_allow_reason( 37 installer->set_off_store_install_allow_reason(
39 extensions::CrxInstaller::OffStoreInstallAllowedInTest); 38 extensions::CrxInstaller::OffStoreInstallAllowedInTest);
40 39
41 observer_->Watch( 40 observer_->Watch(
42 extensions::NOTIFICATION_CRX_INSTALLER_DONE, 41 extensions::NOTIFICATION_CRX_INSTALLER_DONE,
43 content::Source<extensions::CrxInstaller>(installer.get())); 42 content::Source<extensions::CrxInstaller>(installer.get()));
44 43
45 installer->InstallCrx(path); 44 installer->InstallCrx(path);
46 observer_->Wait(); 45 observer_->Wait();
47 46
48 size_t num_after = registry->enabled_extensions().size(); 47 size_t num_after = registry->enabled_extensions().size();
49 EXPECT_EQ(num_before + 1, num_after); 48 EXPECT_EQ(num_before + 1, num_after);
50 49
51 extension_loaded_observer.Wait(); 50 extension_observer.WaitForExtensionLoaded();
52 const Extension* extension = 51 const Extension* extension =
53 registry->enabled_extensions().GetByID(last_loaded_extension_id()); 52 registry->enabled_extensions().GetByID(last_loaded_extension_id());
54 EXPECT_TRUE(extension); 53 EXPECT_TRUE(extension);
55 } 54 }
56 }; 55 };
57 56
58 IN_PROC_BROWSER_TEST_F(ExtensionFunctionalTest, 57 IN_PROC_BROWSER_TEST_F(ExtensionFunctionalTest,
59 PRE_TestAdblockExtensionCrash) { 58 PRE_TestAdblockExtensionCrash) {
60 InstallExtensionSilently(extension_service(), "adblock.crx"); 59 InstallExtensionSilently(extension_service(), "adblock.crx");
61 } 60 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 service->EnableExtension(last_loaded_extension_id()); 99 service->EnableExtension(last_loaded_extension_id());
101 util::SetIsIncognitoEnabled(last_loaded_extension_id(), profile(), true); 100 util::SetIsIncognitoEnabled(last_loaded_extension_id(), profile(), true);
102 EXPECT_TRUE(util::IsIncognitoEnabled(last_loaded_extension_id(), profile())); 101 EXPECT_TRUE(util::IsIncognitoEnabled(last_loaded_extension_id(), profile()));
103 102
104 // Disallow extension in incognito mode and verify. 103 // Disallow extension in incognito mode and verify.
105 service->EnableExtension(last_loaded_extension_id()); 104 service->EnableExtension(last_loaded_extension_id());
106 util::SetIsIncognitoEnabled(last_loaded_extension_id(), profile(), false); 105 util::SetIsIncognitoEnabled(last_loaded_extension_id(), profile(), false);
107 EXPECT_FALSE(util::IsIncognitoEnabled(last_loaded_extension_id(), profile())); 106 EXPECT_FALSE(util::IsIncognitoEnabled(last_loaded_extension_id(), profile()));
108 } 107 }
109 } // namespace extensions 108 } // namespace extensions
OLDNEW
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698