| 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 "chrome/common/extensions/extension.h" | 5 #include "chrome/common/extensions/extension.h" |
| 6 | 6 |
| 7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 hosts = extension->GetEffectiveHostPermissions(); | 382 hosts = extension->GetEffectiveHostPermissions(); |
| 383 EXPECT_TRUE(hosts.MatchesURL(GURL("http://google.com"))); | 383 EXPECT_TRUE(hosts.MatchesURL(GURL("http://google.com"))); |
| 384 EXPECT_TRUE(hosts.MatchesURL(GURL("https://google.com"))); | 384 EXPECT_TRUE(hosts.MatchesURL(GURL("https://google.com"))); |
| 385 EXPECT_FALSE(extension->HasEffectiveAccessToAllHosts()); | 385 EXPECT_FALSE(extension->HasEffectiveAccessToAllHosts()); |
| 386 | 386 |
| 387 extension = LoadManifest("effective_host_permissions", | 387 extension = LoadManifest("effective_host_permissions", |
| 388 "two_content_scripts.json"); | 388 "two_content_scripts.json"); |
| 389 hosts = extension->GetEffectiveHostPermissions(); | 389 hosts = extension->GetEffectiveHostPermissions(); |
| 390 EXPECT_TRUE(hosts.MatchesURL(GURL("http://google.com"))); | 390 EXPECT_TRUE(hosts.MatchesURL(GURL("http://google.com"))); |
| 391 EXPECT_TRUE(hosts.MatchesURL(GURL("http://www.reddit.com"))); | 391 EXPECT_TRUE(hosts.MatchesURL(GURL("http://www.reddit.com"))); |
| 392 EXPECT_TRUE(extension->permission_set()->HasEffectiveAccessToURL( | 392 EXPECT_TRUE(extension->GetActivePermissions()->HasEffectiveAccessToURL( |
| 393 GURL("http://www.reddit.com"))); | 393 GURL("http://www.reddit.com"))); |
| 394 EXPECT_TRUE(hosts.MatchesURL(GURL("http://news.ycombinator.com"))); | 394 EXPECT_TRUE(hosts.MatchesURL(GURL("http://news.ycombinator.com"))); |
| 395 EXPECT_TRUE(extension->permission_set()->HasEffectiveAccessToURL( | 395 EXPECT_TRUE(extension->GetActivePermissions()->HasEffectiveAccessToURL( |
| 396 GURL("http://news.ycombinator.com"))); | 396 GURL("http://news.ycombinator.com"))); |
| 397 EXPECT_FALSE(extension->HasEffectiveAccessToAllHosts()); | 397 EXPECT_FALSE(extension->HasEffectiveAccessToAllHosts()); |
| 398 | 398 |
| 399 extension = LoadManifest("effective_host_permissions", "all_hosts.json"); | 399 extension = LoadManifest("effective_host_permissions", "all_hosts.json"); |
| 400 hosts = extension->GetEffectiveHostPermissions(); | 400 hosts = extension->GetEffectiveHostPermissions(); |
| 401 EXPECT_TRUE(hosts.MatchesURL(GURL("http://test/"))); | 401 EXPECT_TRUE(hosts.MatchesURL(GURL("http://test/"))); |
| 402 EXPECT_FALSE(hosts.MatchesURL(GURL("https://test/"))); | 402 EXPECT_FALSE(hosts.MatchesURL(GURL("https://test/"))); |
| 403 EXPECT_TRUE(hosts.MatchesURL(GURL("http://www.google.com"))); | 403 EXPECT_TRUE(hosts.MatchesURL(GURL("http://www.google.com"))); |
| 404 EXPECT_TRUE(extension->HasEffectiveAccessToAllHosts()); | 404 EXPECT_TRUE(extension->HasEffectiveAccessToAllHosts()); |
| 405 | 405 |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 EXPECT_TRUE(Extension::GenerateId("test", &result)); | 765 EXPECT_TRUE(Extension::GenerateId("test", &result)); |
| 766 EXPECT_EQ(result, "jpignaibiiemhngfjkcpokkamffknabf"); | 766 EXPECT_EQ(result, "jpignaibiiemhngfjkcpokkamffknabf"); |
| 767 | 767 |
| 768 EXPECT_TRUE(Extension::GenerateId("_", &result)); | 768 EXPECT_TRUE(Extension::GenerateId("_", &result)); |
| 769 EXPECT_EQ(result, "ncocknphbhhlhkikpnnlmbcnbgdempcd"); | 769 EXPECT_EQ(result, "ncocknphbhhlhkikpnnlmbcnbgdempcd"); |
| 770 | 770 |
| 771 EXPECT_TRUE(Extension::GenerateId( | 771 EXPECT_TRUE(Extension::GenerateId( |
| 772 "this_string_is_longer_than_a_single_sha256_hash_digest", &result)); | 772 "this_string_is_longer_than_a_single_sha256_hash_digest", &result)); |
| 773 EXPECT_EQ(result, "jimneklojkjdibfkgiiophfhjhbdgcfi"); | 773 EXPECT_EQ(result, "jimneklojkjdibfkgiiophfhjhbdgcfi"); |
| 774 } | 774 } |
| OLD | NEW |