| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/shared_worker/shared_worker_instance.h" | 5 #include "content/browser/shared_worker/shared_worker_instance.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 SharedWorkerInstance instance2( | 69 SharedWorkerInstance instance2( |
| 70 GURL("http://example.com/w.js"), base::ASCIIToUTF16("name"), | 70 GURL("http://example.com/w.js"), base::ASCIIToUTF16("name"), |
| 71 base::string16(), blink::WebContentSecurityPolicyTypeReport, | 71 base::string16(), blink::WebContentSecurityPolicyTypeReport, |
| 72 blink::WebAddressSpacePublic, browser_context_->GetResourceContext(), | 72 blink::WebAddressSpacePublic, browser_context_->GetResourceContext(), |
| 73 partition_id_, blink::WebSharedWorkerCreationContextTypeNonsecure); | 73 partition_id_, blink::WebSharedWorkerCreationContextTypeNonsecure); |
| 74 EXPECT_FALSE(Matches(instance2, "http://example.com/w.js", "")); | 74 EXPECT_FALSE(Matches(instance2, "http://example.com/w.js", "")); |
| 75 EXPECT_FALSE(Matches(instance2, "http://example.com/w2.js", "")); | 75 EXPECT_FALSE(Matches(instance2, "http://example.com/w2.js", "")); |
| 76 EXPECT_FALSE(Matches(instance2, "http://example.net/w.js", "")); | 76 EXPECT_FALSE(Matches(instance2, "http://example.net/w.js", "")); |
| 77 EXPECT_FALSE(Matches(instance2, "http://example.net/w2.js", "")); | 77 EXPECT_FALSE(Matches(instance2, "http://example.net/w2.js", "")); |
| 78 EXPECT_TRUE(Matches(instance2, "http://example.com/w.js", "name")); | 78 EXPECT_TRUE(Matches(instance2, "http://example.com/w.js", "name")); |
| 79 EXPECT_TRUE(Matches(instance2, "http://example.com/w2.js", "name")); | 79 EXPECT_FALSE(Matches(instance2, "http://example.com/w2.js", "name")); |
| 80 EXPECT_FALSE(Matches(instance2, "http://example.net/w.js", "name")); | 80 EXPECT_FALSE(Matches(instance2, "http://example.net/w.js", "name")); |
| 81 EXPECT_FALSE(Matches(instance2, "http://example.net/w2.js", "name")); | 81 EXPECT_FALSE(Matches(instance2, "http://example.net/w2.js", "name")); |
| 82 EXPECT_FALSE(Matches(instance2, "http://example.com/w.js", "name2")); | 82 EXPECT_FALSE(Matches(instance2, "http://example.com/w.js", "name2")); |
| 83 EXPECT_FALSE(Matches(instance2, "http://example.com/w2.js", "name2")); | 83 EXPECT_FALSE(Matches(instance2, "http://example.com/w2.js", "name2")); |
| 84 EXPECT_FALSE(Matches(instance2, "http://example.net/w.js", "name2")); | 84 EXPECT_FALSE(Matches(instance2, "http://example.net/w.js", "name2")); |
| 85 EXPECT_FALSE(Matches(instance2, "http://example.net/w2.js", "name2")); | 85 EXPECT_FALSE(Matches(instance2, "http://example.net/w2.js", "name2")); |
| 86 } | 86 } |
| 87 | 87 |
| 88 TEST_F(SharedWorkerInstanceTest, AddressSpace) { | 88 TEST_F(SharedWorkerInstanceTest, AddressSpace) { |
| 89 for (int i = 0; i < static_cast<int>(blink::WebAddressSpaceLast); i++) { | 89 for (int i = 0; i < static_cast<int>(blink::WebAddressSpaceLast); i++) { |
| 90 SharedWorkerInstance instance( | 90 SharedWorkerInstance instance( |
| 91 GURL("http://example.com/w.js"), base::ASCIIToUTF16("name"), | 91 GURL("http://example.com/w.js"), base::ASCIIToUTF16("name"), |
| 92 base::string16(), blink::WebContentSecurityPolicyTypeReport, | 92 base::string16(), blink::WebContentSecurityPolicyTypeReport, |
| 93 static_cast<blink::WebAddressSpace>(i), | 93 static_cast<blink::WebAddressSpace>(i), |
| 94 browser_context_->GetResourceContext(), partition_id_, | 94 browser_context_->GetResourceContext(), partition_id_, |
| 95 blink::WebSharedWorkerCreationContextTypeNonsecure); | 95 blink::WebSharedWorkerCreationContextTypeNonsecure); |
| 96 EXPECT_EQ(static_cast<blink::WebAddressSpace>(i), | 96 EXPECT_EQ(static_cast<blink::WebAddressSpace>(i), |
| 97 instance.creation_address_space()); | 97 instance.creation_address_space()); |
| 98 } | 98 } |
| 99 } | 99 } |
| 100 | 100 |
| 101 } // namespace content | 101 } // namespace content |
| OLD | NEW |