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

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

Issue 425303002: Move extension notifications to extensions/browser/notification_types.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: (extension-notifications) rebase Created 6 years, 4 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"
6 #include "chrome/browser/extensions/crx_installer.h" 5 #include "chrome/browser/extensions/crx_installer.h"
7 #include "chrome/browser/extensions/extension_browsertest.h" 6 #include "chrome/browser/extensions/extension_browsertest.h"
8 #include "chrome/browser/extensions/extension_service.h" 7 #include "chrome/browser/extensions/extension_service.h"
9 #include "chrome/browser/extensions/extension_util.h" 8 #include "chrome/browser/extensions/extension_util.h"
10 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/ui/browser_commands.h" 10 #include "chrome/browser/ui/browser_commands.h"
12 #include "chrome/test/base/ui_test_utils.h" 11 #include "chrome/test/base/ui_test_utils.h"
13 #include "content/public/browser/notification_service.h" 12 #include "content/public/browser/notification_service.h"
14 #include "extensions/browser/extension_system.h" 13 #include "extensions/browser/extension_system.h"
14 #include "extensions/browser/notification_types.h"
15 15
16 namespace extensions { 16 namespace extensions {
17 17
18 class ExtensionFunctionalTest : public ExtensionBrowserTest { 18 class ExtensionFunctionalTest : public ExtensionBrowserTest {
19 public: 19 public:
20 void InstallExtensionSilently(ExtensionService* service, 20 void InstallExtensionSilently(ExtensionService* service,
21 const char* filename) { 21 const char* filename) {
22 service->set_show_extensions_prompts(false); 22 service->set_show_extensions_prompts(false);
23 size_t num_before = service->extensions()->size(); 23 size_t num_before = service->extensions()->size();
24 24
25 base::FilePath path = test_data_dir_.AppendASCII(filename); 25 base::FilePath path = test_data_dir_.AppendASCII(filename);
26 26
27 content::WindowedNotificationObserver extension_loaded_observer( 27 content::WindowedNotificationObserver extension_loaded_observer(
28 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, 28 extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED,
29 content::NotificationService::AllSources()); 29 content::NotificationService::AllSources());
30 30
31 scoped_refptr<extensions::CrxInstaller> installer( 31 scoped_refptr<extensions::CrxInstaller> installer(
32 extensions::CrxInstaller::CreateSilent(service)); 32 extensions::CrxInstaller::CreateSilent(service));
33 installer->set_is_gallery_install(false); 33 installer->set_is_gallery_install(false);
34 installer->set_allow_silent_install(true); 34 installer->set_allow_silent_install(true);
35 installer->set_install_source(Manifest::INTERNAL); 35 installer->set_install_source(Manifest::INTERNAL);
36 installer->set_off_store_install_allow_reason( 36 installer->set_off_store_install_allow_reason(
37 extensions::CrxInstaller::OffStoreInstallAllowedInTest); 37 extensions::CrxInstaller::OffStoreInstallAllowedInTest);
38 38
39 observer_->Watch( 39 observer_->Watch(
40 chrome::NOTIFICATION_CRX_INSTALLER_DONE, 40 extensions::NOTIFICATION_CRX_INSTALLER_DONE,
41 content::Source<extensions::CrxInstaller>(installer.get())); 41 content::Source<extensions::CrxInstaller>(installer.get()));
42 42
43 installer->InstallCrx(path); 43 installer->InstallCrx(path);
44 observer_->Wait(); 44 observer_->Wait();
45 45
46 size_t num_after = service->extensions()->size(); 46 size_t num_after = service->extensions()->size();
47 EXPECT_EQ(num_before + 1, num_after); 47 EXPECT_EQ(num_before + 1, num_after);
48 48
49 extension_loaded_observer.Wait(); 49 extension_loaded_observer.Wait();
50 const Extension* extension = service->GetExtensionById( 50 const Extension* extension = service->GetExtensionById(
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 service->EnableExtension(last_loaded_extension_id()); 102 service->EnableExtension(last_loaded_extension_id());
103 util::SetIsIncognitoEnabled(last_loaded_extension_id(), profile(), true); 103 util::SetIsIncognitoEnabled(last_loaded_extension_id(), profile(), true);
104 EXPECT_TRUE(util::IsIncognitoEnabled(last_loaded_extension_id(), profile())); 104 EXPECT_TRUE(util::IsIncognitoEnabled(last_loaded_extension_id(), profile()));
105 105
106 // Disallow extension in incognito mode and verify. 106 // Disallow extension in incognito mode and verify.
107 service->EnableExtension(last_loaded_extension_id()); 107 service->EnableExtension(last_loaded_extension_id());
108 util::SetIsIncognitoEnabled(last_loaded_extension_id(), profile(), false); 108 util::SetIsIncognitoEnabled(last_loaded_extension_id(), profile(), false);
109 EXPECT_FALSE(util::IsIncognitoEnabled(last_loaded_extension_id(), profile())); 109 EXPECT_FALSE(util::IsIncognitoEnabled(last_loaded_extension_id(), profile()));
110 } 110 }
111 } // namespace extensions 111 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_error_reporter.cc ('k') | chrome/browser/extensions/extension_gcm_app_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698