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" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "content/browser/shared_worker/worker_storage_partition.h" | 12 #include "content/browser/shared_worker/worker_storage_partition.h" |
13 #include "content/public/browser/storage_partition.h" | |
14 #include "content/public/test/test_browser_context.h" | 13 #include "content/public/test/test_browser_context.h" |
15 #include "content/public/test/test_browser_thread_bundle.h" | 14 #include "content/public/test/test_browser_thread_bundle.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
17 | 16 |
18 namespace content { | 17 namespace content { |
19 | 18 |
20 class SharedWorkerInstanceTest : public testing::Test { | 19 class SharedWorkerInstanceTest : public testing::Test { |
21 protected: | 20 protected: |
22 SharedWorkerInstanceTest() | 21 SharedWorkerInstanceTest() |
23 : browser_context_(new TestBrowserContext()), | 22 : browser_context_(new TestBrowserContext()), |
24 partition_(new WorkerStoragePartition( | 23 partition_( |
25 BrowserContext::GetDefaultStoragePartition(browser_context_.get())-> | 24 new WorkerStoragePartition(browser_context_->GetRequestContext(), |
26 GetURLRequestContext(), | 25 NULL, |
27 NULL, | 26 NULL, |
28 NULL, | 27 NULL, |
29 NULL, | 28 NULL, |
30 NULL, | 29 NULL, |
31 NULL, | 30 NULL, |
32 NULL, | 31 NULL)), |
33 NULL)), | |
34 partition_id_(*partition_.get()) {} | 32 partition_id_(*partition_.get()) {} |
35 | 33 |
36 bool Matches(const SharedWorkerInstance& instance, | 34 bool Matches(const SharedWorkerInstance& instance, |
37 const std::string& url, | 35 const std::string& url, |
38 const base::StringPiece& name) { | 36 const base::StringPiece& name) { |
39 return instance.Matches(GURL(url), | 37 return instance.Matches(GURL(url), |
40 base::ASCIIToUTF16(name), | 38 base::ASCIIToUTF16(name), |
41 partition_id_, | 39 partition_id_, |
42 browser_context_->GetResourceContext()); | 40 browser_context_->GetResourceContext()); |
43 } | 41 } |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 base::string16(), blink::WebContentSecurityPolicyTypeReport, | 89 base::string16(), blink::WebContentSecurityPolicyTypeReport, |
92 static_cast<blink::WebAddressSpace>(i), | 90 static_cast<blink::WebAddressSpace>(i), |
93 browser_context_->GetResourceContext(), partition_id_, | 91 browser_context_->GetResourceContext(), partition_id_, |
94 blink::WebSharedWorkerCreationContextTypeNonsecure); | 92 blink::WebSharedWorkerCreationContextTypeNonsecure); |
95 EXPECT_EQ(static_cast<blink::WebAddressSpace>(i), | 93 EXPECT_EQ(static_cast<blink::WebAddressSpace>(i), |
96 instance.creation_address_space()); | 94 instance.creation_address_space()); |
97 } | 95 } |
98 } | 96 } |
99 | 97 |
100 } // namespace content | 98 } // namespace content |
OLD | NEW |