OLD | NEW |
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 <string> | 5 #include <string> |
6 | 6 |
7 #include "chrome/browser/extensions/extension_service.h" | 7 #include "chrome/browser/extensions/extension_service.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/common/chrome_notification_types.h" | 10 #include "chrome/common/chrome_notification_types.h" |
11 #include "chrome/common/chrome_switches.h" | 11 #include "chrome/common/chrome_switches.h" |
12 #include "chrome/common/extensions/extension.h" | 12 #include "chrome/common/extensions/extension.h" |
13 #include "chrome/test/base/in_process_browser_test.h" | 13 #include "chrome/test/base/in_process_browser_test.h" |
14 #include "chrome/test/base/ui_test_utils.h" | 14 #include "chrome/test/base/ui_test_utils.h" |
15 #include "content/public/browser/notification_details.h" | 15 #include "content/public/browser/notification_details.h" |
16 #include "content/public/browser/notification_observer.h" | 16 #include "content/public/browser/notification_observer.h" |
17 #include "content/public/browser/notification_registrar.h" | 17 #include "content/public/browser/notification_registrar.h" |
| 18 #include "content/public/browser/notification_service.h" |
18 | 19 |
19 class ExtensionFromWebAppTest | 20 class ExtensionFromWebAppTest |
20 : public InProcessBrowserTest, public content::NotificationObserver { | 21 : public InProcessBrowserTest, public content::NotificationObserver { |
21 protected: | 22 protected: |
22 ExtensionFromWebAppTest() : installed_extension_(NULL) { | 23 ExtensionFromWebAppTest() : installed_extension_(NULL) { |
23 } | 24 } |
24 | 25 |
25 std::string expected_extension_id_; | 26 std::string expected_extension_id_; |
26 const Extension* installed_extension_; | 27 const Extension* installed_extension_; |
27 | 28 |
(...skipping 18 matching lines...) Expand all Loading... |
46 } | 47 } |
47 }; | 48 }; |
48 | 49 |
49 IN_PROC_BROWSER_TEST_F(ExtensionFromWebAppTest, Basic) { | 50 IN_PROC_BROWSER_TEST_F(ExtensionFromWebAppTest, Basic) { |
50 ASSERT_TRUE(test_server()->Start()); | 51 ASSERT_TRUE(test_server()->Start()); |
51 browser()->profile()->GetExtensionService()->set_show_extensions_prompts( | 52 browser()->profile()->GetExtensionService()->set_show_extensions_prompts( |
52 false); | 53 false); |
53 | 54 |
54 content::NotificationRegistrar registrar; | 55 content::NotificationRegistrar registrar; |
55 registrar.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED, | 56 registrar.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED, |
56 NotificationService::AllSources()); | 57 content::NotificationService::AllSources()); |
57 | 58 |
58 expected_extension_id_ = "fnpgoaochgbdfjndakichfafiocjjpmm"; | 59 expected_extension_id_ = "fnpgoaochgbdfjndakichfafiocjjpmm"; |
59 ui_test_utils::NavigateToURL( | 60 ui_test_utils::NavigateToURL( |
60 browser(), | 61 browser(), |
61 test_server()->GetURL( | 62 test_server()->GetURL( |
62 "files/extensions/convert_web_app/application.html")); | 63 "files/extensions/convert_web_app/application.html")); |
63 | 64 |
64 if (!installed_extension_) | 65 if (!installed_extension_) |
65 ui_test_utils::RunMessageLoop(); | 66 ui_test_utils::RunMessageLoop(); |
66 | 67 |
(...skipping 11 matching lines...) Expand all Loading... |
78 ExtensionAPIPermission::kNotification)); | 79 ExtensionAPIPermission::kNotification)); |
79 | 80 |
80 ASSERT_EQ(3u, installed_extension_->icons().map().size()); | 81 ASSERT_EQ(3u, installed_extension_->icons().map().size()); |
81 EXPECT_EQ("icons/16.png", installed_extension_->icons().Get( | 82 EXPECT_EQ("icons/16.png", installed_extension_->icons().Get( |
82 16, ExtensionIconSet::MATCH_EXACTLY)); | 83 16, ExtensionIconSet::MATCH_EXACTLY)); |
83 EXPECT_EQ("icons/48.png", installed_extension_->icons().Get( | 84 EXPECT_EQ("icons/48.png", installed_extension_->icons().Get( |
84 48, ExtensionIconSet::MATCH_EXACTLY)); | 85 48, ExtensionIconSet::MATCH_EXACTLY)); |
85 EXPECT_EQ("icons/128.png", installed_extension_->icons().Get( | 86 EXPECT_EQ("icons/128.png", installed_extension_->icons().Get( |
86 128, ExtensionIconSet::MATCH_EXACTLY)); | 87 128, ExtensionIconSet::MATCH_EXACTLY)); |
87 } | 88 } |
OLD | NEW |