| OLD | NEW |
| 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 "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/browser/ui/tabs/tab_strip_model.h" | 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 11 #include "chrome/common/chrome_notification_types.h" | 11 #include "chrome/common/chrome_notification_types.h" |
| 12 #include "chrome/common/chrome_switches.h" | 12 #include "chrome/common/chrome_switches.h" |
| 13 #include "chrome/common/extensions/api/icons/icons_handler.h" | 13 #include "chrome/common/extensions/api/icons/icons_handler.h" |
| 14 #include "chrome/common/extensions/api/requirements/requirements_handler.h" |
| 14 #include "chrome/common/extensions/extension.h" | 15 #include "chrome/common/extensions/extension.h" |
| 15 #include "chrome/common/extensions/extension_icon_set.h" | 16 #include "chrome/common/extensions/extension_icon_set.h" |
| 17 #include "chrome/common/extensions/manifest_handler.h" |
| 16 #include "chrome/common/extensions/permissions/permission_set.h" | 18 #include "chrome/common/extensions/permissions/permission_set.h" |
| 17 #include "chrome/test/base/in_process_browser_test.h" | 19 #include "chrome/test/base/in_process_browser_test.h" |
| 18 #include "chrome/test/base/ui_test_utils.h" | 20 #include "chrome/test/base/ui_test_utils.h" |
| 19 #include "content/public/browser/notification_details.h" | 21 #include "content/public/browser/notification_details.h" |
| 20 #include "content/public/browser/notification_observer.h" | 22 #include "content/public/browser/notification_observer.h" |
| 21 #include "content/public/browser/notification_registrar.h" | 23 #include "content/public/browser/notification_registrar.h" |
| 22 #include "content/public/browser/notification_service.h" | 24 #include "content/public/browser/notification_service.h" |
| 23 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
| 24 #include "content/public/test/browser_test_utils.h" | 26 #include "content/public/test/browser_test_utils.h" |
| 25 | 27 |
| 26 namespace extensions { | 28 namespace extensions { |
| 27 | 29 |
| 28 class ExtensionFromWebAppTest | 30 class ExtensionFromWebAppTest |
| 29 : public InProcessBrowserTest, public content::NotificationObserver { | 31 : public InProcessBrowserTest, public content::NotificationObserver { |
| 30 protected: | 32 protected: |
| 31 ExtensionFromWebAppTest() : installed_extension_(NULL) { | 33 ExtensionFromWebAppTest() : installed_extension_(NULL) { |
| 32 } | 34 } |
| 33 | 35 |
| 36 virtual void SetUpOnMainThread() OVERRIDE { |
| 37 InProcessBrowserTest::SetUpOnMainThread(); |
| 38 (new RequirementsHandler)->Register(); |
| 39 } |
| 40 |
| 41 virtual void CleanUpOnMainThread() OVERRIDE { |
| 42 ManifestHandler::ClearRegistryForTesting(); |
| 43 InProcessBrowserTest::CleanUpOnMainThread(); |
| 44 } |
| 45 |
| 34 std::string expected_extension_id_; | 46 std::string expected_extension_id_; |
| 35 const Extension* installed_extension_; | 47 const Extension* installed_extension_; |
| 36 | 48 |
| 37 private: | 49 private: |
| 38 // content::NotificationObserver | 50 // content::NotificationObserver |
| 39 virtual void Observe(int type, | 51 virtual void Observe(int type, |
| 40 const content::NotificationSource& source, | 52 const content::NotificationSource& source, |
| 41 const content::NotificationDetails& details) OVERRIDE { | 53 const content::NotificationDetails& details) OVERRIDE { |
| 42 if (type == chrome::NOTIFICATION_EXTENSION_INSTALLED) { | 54 if (type == chrome::NOTIFICATION_EXTENSION_INSTALLED) { |
| 43 const Extension* extension = | 55 const Extension* extension = |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 EXPECT_EQ("Test application", installed_extension_->name()); | 94 EXPECT_EQ("Test application", installed_extension_->name()); |
| 83 EXPECT_EQ("", installed_extension_->description()); | 95 EXPECT_EQ("", installed_extension_->description()); |
| 84 EXPECT_EQ("http://www.example.com/", installed_extension_->launch_web_url()); | 96 EXPECT_EQ("http://www.example.com/", installed_extension_->launch_web_url()); |
| 85 EXPECT_EQ(extension_misc::LAUNCH_TAB, | 97 EXPECT_EQ(extension_misc::LAUNCH_TAB, |
| 86 installed_extension_->launch_container()); | 98 installed_extension_->launch_container()); |
| 87 EXPECT_EQ(0u, installed_extension_->GetActivePermissions()->apis().size()); | 99 EXPECT_EQ(0u, installed_extension_->GetActivePermissions()->apis().size()); |
| 88 EXPECT_EQ(0u, IconsInfo::GetIcons(installed_extension_).map().size()); | 100 EXPECT_EQ(0u, IconsInfo::GetIcons(installed_extension_).map().size()); |
| 89 } | 101 } |
| 90 | 102 |
| 91 } // namespace extensions | 103 } // namespace extensions |
| OLD | NEW |