OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 hosts = extension->permissions_data()->GetEffectiveHostPermissions(); | 126 hosts = extension->permissions_data()->GetEffectiveHostPermissions(); |
127 EXPECT_TRUE(hosts.MatchesURL(GURL("http://google.com"))); | 127 EXPECT_TRUE(hosts.MatchesURL(GURL("http://google.com"))); |
128 EXPECT_TRUE(hosts.MatchesURL(GURL("https://google.com"))); | 128 EXPECT_TRUE(hosts.MatchesURL(GURL("https://google.com"))); |
129 EXPECT_FALSE(extension->permissions_data()->HasEffectiveAccessToAllHosts()); | 129 EXPECT_FALSE(extension->permissions_data()->HasEffectiveAccessToAllHosts()); |
130 | 130 |
131 extension = LoadManifest("effective_host_permissions", | 131 extension = LoadManifest("effective_host_permissions", |
132 "two_content_scripts.json"); | 132 "two_content_scripts.json"); |
133 hosts = extension->permissions_data()->GetEffectiveHostPermissions(); | 133 hosts = extension->permissions_data()->GetEffectiveHostPermissions(); |
134 EXPECT_TRUE(hosts.MatchesURL(GURL("http://google.com"))); | 134 EXPECT_TRUE(hosts.MatchesURL(GURL("http://google.com"))); |
135 EXPECT_TRUE(hosts.MatchesURL(GURL("http://www.reddit.com"))); | 135 EXPECT_TRUE(hosts.MatchesURL(GURL("http://www.reddit.com"))); |
136 EXPECT_TRUE(extension->GetActivePermissions()->HasEffectiveAccessToURL( | 136 EXPECT_TRUE(extension->permissions_data() |
137 GURL("http://www.reddit.com"))); | 137 ->active_permissions() |
| 138 ->HasEffectiveAccessToURL(GURL("http://www.reddit.com"))); |
138 EXPECT_TRUE(hosts.MatchesURL(GURL("http://news.ycombinator.com"))); | 139 EXPECT_TRUE(hosts.MatchesURL(GURL("http://news.ycombinator.com"))); |
139 EXPECT_TRUE(extension->GetActivePermissions()->HasEffectiveAccessToURL( | 140 EXPECT_TRUE( |
140 GURL("http://news.ycombinator.com"))); | 141 extension->permissions_data() |
| 142 ->active_permissions() |
| 143 ->HasEffectiveAccessToURL(GURL("http://news.ycombinator.com"))); |
141 EXPECT_FALSE(extension->permissions_data()->HasEffectiveAccessToAllHosts()); | 144 EXPECT_FALSE(extension->permissions_data()->HasEffectiveAccessToAllHosts()); |
142 | 145 |
143 extension = LoadManifest("effective_host_permissions", "all_hosts.json"); | 146 extension = LoadManifest("effective_host_permissions", "all_hosts.json"); |
144 hosts = extension->permissions_data()->GetEffectiveHostPermissions(); | 147 hosts = extension->permissions_data()->GetEffectiveHostPermissions(); |
145 EXPECT_TRUE(hosts.MatchesURL(GURL("http://test/"))); | 148 EXPECT_TRUE(hosts.MatchesURL(GURL("http://test/"))); |
146 EXPECT_FALSE(hosts.MatchesURL(GURL("https://test/"))); | 149 EXPECT_FALSE(hosts.MatchesURL(GURL("https://test/"))); |
147 EXPECT_TRUE(hosts.MatchesURL(GURL("http://www.google.com"))); | 150 EXPECT_TRUE(hosts.MatchesURL(GURL("http://www.google.com"))); |
148 EXPECT_TRUE(extension->permissions_data()->HasEffectiveAccessToAllHosts()); | 151 EXPECT_TRUE(extension->permissions_data()->HasEffectiveAccessToAllHosts()); |
149 | 152 |
150 extension = LoadManifest("effective_host_permissions", "all_hosts2.json"); | 153 extension = LoadManifest("effective_host_permissions", "all_hosts2.json"); |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 | 713 |
711 permissions_data->ClearTabSpecificPermissions(1); | 714 permissions_data->ClearTabSpecificPermissions(1); |
712 EXPECT_FALSE(permissions_data->GetTabSpecificPermissionsForTesting(1)); | 715 EXPECT_FALSE(permissions_data->GetTabSpecificPermissionsForTesting(1)); |
713 | 716 |
714 EXPECT_TRUE(ScriptAllowedExclusivelyOnTab(extension.get(), no_urls, 0)); | 717 EXPECT_TRUE(ScriptAllowedExclusivelyOnTab(extension.get(), no_urls, 0)); |
715 EXPECT_TRUE(ScriptAllowedExclusivelyOnTab(extension.get(), no_urls, 1)); | 718 EXPECT_TRUE(ScriptAllowedExclusivelyOnTab(extension.get(), no_urls, 1)); |
716 EXPECT_TRUE(ScriptAllowedExclusivelyOnTab(extension.get(), no_urls, 2)); | 719 EXPECT_TRUE(ScriptAllowedExclusivelyOnTab(extension.get(), no_urls, 2)); |
717 } | 720 } |
718 | 721 |
719 } // namespace extensions | 722 } // namespace extensions |
OLD | NEW |