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

Side by Side Diff: chrome/browser/extensions/convert_web_app_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 <string> 5 #include <string>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/extensions/extension_service.h" 8 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
12 #include "chrome/browser/ui/tabs/tab_strip_model.h" 11 #include "chrome/browser/ui/tabs/tab_strip_model.h"
13 #include "chrome/common/chrome_switches.h" 12 #include "chrome/common/chrome_switches.h"
14 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" 13 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h"
15 #include "chrome/test/base/in_process_browser_test.h" 14 #include "chrome/test/base/in_process_browser_test.h"
16 #include "chrome/test/base/test_switches.h" 15 #include "chrome/test/base/test_switches.h"
17 #include "chrome/test/base/ui_test_utils.h" 16 #include "chrome/test/base/ui_test_utils.h"
18 #include "content/public/browser/notification_details.h" 17 #include "content/public/browser/notification_details.h"
19 #include "content/public/browser/notification_observer.h" 18 #include "content/public/browser/notification_observer.h"
20 #include "content/public/browser/notification_registrar.h" 19 #include "content/public/browser/notification_registrar.h"
21 #include "content/public/browser/notification_service.h" 20 #include "content/public/browser/notification_service.h"
22 #include "content/public/browser/web_contents.h" 21 #include "content/public/browser/web_contents.h"
23 #include "content/public/test/browser_test_utils.h" 22 #include "content/public/test/browser_test_utils.h"
24 #include "extensions/browser/extension_system.h" 23 #include "extensions/browser/extension_system.h"
24 #include "extensions/browser/notification_types.h"
25 #include "extensions/common/extension.h" 25 #include "extensions/common/extension.h"
26 #include "extensions/common/extension_icon_set.h" 26 #include "extensions/common/extension_icon_set.h"
27 #include "extensions/common/manifest_handlers/icons_handler.h" 27 #include "extensions/common/manifest_handlers/icons_handler.h"
28 #include "extensions/common/permissions/permission_set.h" 28 #include "extensions/common/permissions/permission_set.h"
29 #include "extensions/common/permissions/permissions_data.h" 29 #include "extensions/common/permissions/permissions_data.h"
30 30
31 namespace extensions { 31 namespace extensions {
32 32
33 class ExtensionFromWebAppTest 33 class ExtensionFromWebAppTest
34 : public InProcessBrowserTest, public content::NotificationObserver { 34 : public InProcessBrowserTest, public content::NotificationObserver {
35 protected: 35 protected:
36 ExtensionFromWebAppTest() : installed_extension_(NULL) { 36 ExtensionFromWebAppTest() : installed_extension_(NULL) {
37 } 37 }
38 38
39 std::string expected_extension_id_; 39 std::string expected_extension_id_;
40 const Extension* installed_extension_; 40 const Extension* installed_extension_;
41 41
42 private: 42 private:
43 // content::NotificationObserver 43 // content::NotificationObserver
44 virtual void Observe(int type, 44 virtual void Observe(int type,
45 const content::NotificationSource& source, 45 const content::NotificationSource& source,
46 const content::NotificationDetails& details) OVERRIDE { 46 const content::NotificationDetails& details) OVERRIDE {
47 if (type == chrome::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED) { 47 if (type ==
48 extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED) {
48 const Extension* extension = 49 const Extension* extension =
49 content::Details<const InstalledExtensionInfo>(details)->extension; 50 content::Details<const InstalledExtensionInfo>(details)->extension;
50 if (extension->id() == expected_extension_id_) { 51 if (extension->id() == expected_extension_id_) {
51 installed_extension_ = extension; 52 installed_extension_ = extension;
52 base::MessageLoopForUI::current()->Quit(); 53 base::MessageLoopForUI::current()->Quit();
53 } 54 }
54 } 55 }
55 } 56 }
56 }; 57 };
57 58
58 // TODO(samarth): delete along with rest of the NTP4 code. 59 // TODO(samarth): delete along with rest of the NTP4 code.
59 IN_PROC_BROWSER_TEST_F(ExtensionFromWebAppTest, DISABLED_Basic) { 60 IN_PROC_BROWSER_TEST_F(ExtensionFromWebAppTest, DISABLED_Basic) {
60 #if defined(OS_WIN) && defined(USE_ASH) 61 #if defined(OS_WIN) && defined(USE_ASH)
61 // Disable this test in Metro+Ash for now (http://crbug.com/262796). 62 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
62 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) 63 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests))
63 return; 64 return;
64 #endif 65 #endif
65 66
66 ExtensionService* service = 67 ExtensionService* service =
67 ExtensionSystem::Get(browser()->profile())->extension_service(); 68 ExtensionSystem::Get(browser()->profile())->extension_service();
68 service->set_show_extensions_prompts(false); 69 service->set_show_extensions_prompts(false);
69 70
70 content::NotificationRegistrar registrar; 71 content::NotificationRegistrar registrar;
71 registrar.Add(this, 72 registrar.Add(this,
72 chrome::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED, 73 extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED,
73 content::NotificationService::AllSources()); 74 content::NotificationService::AllSources());
74 75
75 expected_extension_id_ = "ffnmbohohhobhkjpfbefbjifapgcmpaa"; 76 expected_extension_id_ = "ffnmbohohhobhkjpfbefbjifapgcmpaa";
76 ui_test_utils::NavigateToURL( 77 ui_test_utils::NavigateToURL(
77 browser(), 78 browser(),
78 GURL("chrome://newtab")); 79 GURL("chrome://newtab"));
79 EXPECT_TRUE(content::ExecuteScript( 80 EXPECT_TRUE(content::ExecuteScript(
80 browser()->tab_strip_model()->GetActiveWebContents(), 81 browser()->tab_strip_model()->GetActiveWebContents(),
81 "chrome.send('generateAppForLink', " 82 "chrome.send('generateAppForLink', "
82 "['http://www.example.com', 'Test application', 0])")); 83 "['http://www.example.com', 'Test application', 0])"));
(...skipping 11 matching lines...) Expand all
94 AppLaunchInfo::GetLaunchContainer(installed_extension_)); 95 AppLaunchInfo::GetLaunchContainer(installed_extension_));
95 EXPECT_EQ(0u, 96 EXPECT_EQ(0u,
96 installed_extension_->permissions_data() 97 installed_extension_->permissions_data()
97 ->active_permissions() 98 ->active_permissions()
98 ->apis() 99 ->apis()
99 .size()); 100 .size());
100 EXPECT_EQ(0u, IconsInfo::GetIcons(installed_extension_).map().size()); 101 EXPECT_EQ(0u, IconsInfo::GetIcons(installed_extension_).map().size());
101 } 102 }
102 103
103 } // namespace extensions 104 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/content_script_apitest.cc ('k') | chrome/browser/extensions/crx_installer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698