| 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 "base/message_loop.h" | 5 #include "base/message_loop.h" |
| 6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
| 7 #include "chrome/browser/extensions/extension_info_map.h" | 7 #include "chrome/browser/extensions/extension_info_map.h" |
| 8 #include "chrome/common/chrome_paths.h" | 8 #include "chrome/common/chrome_paths.h" |
| 9 #include "chrome/common/extensions/extension.h" | 9 #include "chrome/common/extensions/extension.h" |
| 10 #include "content/browser/browser_thread.h" | 10 #include "content/browser/browser_thread.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 ASSERT_TRUE(app->web_extent().MatchesURL(app_url)); | 131 ASSERT_TRUE(app->web_extent().MatchesURL(app_url)); |
| 132 | 132 |
| 133 info_map->AddExtension(app, base::Time(), false); | 133 info_map->AddExtension(app, base::Time(), false); |
| 134 info_map->AddExtension(extension, base::Time(), false); | 134 info_map->AddExtension(extension, base::Time(), false); |
| 135 | 135 |
| 136 // The app should have the notifications permission, either from a | 136 // The app should have the notifications permission, either from a |
| 137 // chrome-extension URL or from its web extent. | 137 // chrome-extension URL or from its web extent. |
| 138 const Extension* match = info_map->extensions().GetByURL( | 138 const Extension* match = info_map->extensions().GetByURL( |
| 139 app->GetResourceURL("a.html")); | 139 app->GetResourceURL("a.html")); |
| 140 EXPECT_TRUE(match && | 140 EXPECT_TRUE(match && |
| 141 match->HasApiPermission(Extension::kNotificationPermission)); | 141 match->HasApiPermission(ExtensionAPIPermission::kNotification)); |
| 142 match = info_map->extensions().GetByURL(app_url); | 142 match = info_map->extensions().GetByURL(app_url); |
| 143 EXPECT_TRUE(match && | 143 EXPECT_TRUE(match && |
| 144 match->HasApiPermission(Extension::kNotificationPermission)); | 144 match->HasApiPermission(ExtensionAPIPermission::kNotification)); |
| 145 EXPECT_FALSE(match && | 145 EXPECT_FALSE(match && |
| 146 match->HasApiPermission(Extension::kTabPermission)); | 146 match->HasApiPermission(ExtensionAPIPermission::kTab)); |
| 147 | 147 |
| 148 // The extension should have the tabs permission. | 148 // The extension should have the tabs permission. |
| 149 match = info_map->extensions().GetByURL(extension->GetResourceURL("a.html")); | 149 match = info_map->extensions().GetByURL(extension->GetResourceURL("a.html")); |
| 150 EXPECT_TRUE(match && | 150 EXPECT_TRUE(match && |
| 151 match->HasApiPermission(Extension::kTabPermission)); | 151 match->HasApiPermission(ExtensionAPIPermission::kTab)); |
| 152 EXPECT_FALSE(match && | 152 EXPECT_FALSE(match && |
| 153 match->HasApiPermission(Extension::kNotificationPermission)); | 153 match->HasApiPermission(ExtensionAPIPermission::kNotification)); |
| 154 | 154 |
| 155 // Random URL should not have any permissions. | 155 // Random URL should not have any permissions. |
| 156 match = info_map->extensions().GetByURL(GURL("http://evil.com/a.html")); | 156 match = info_map->extensions().GetByURL(GURL("http://evil.com/a.html")); |
| 157 EXPECT_FALSE(match); | 157 EXPECT_FALSE(match); |
| 158 } | 158 } |
| 159 | 159 |
| 160 } // namespace | 160 } // namespace |
| OLD | NEW |