Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: content/browser/shared_worker/shared_worker_instance_unittest.cc

Issue 1864583006: Simplify BrowserContext by removing redundant methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
13 #include "content/public/test/test_browser_context.h" 14 #include "content/public/test/test_browser_context.h"
14 #include "content/public/test/test_browser_thread_bundle.h" 15 #include "content/public/test/test_browser_thread_bundle.h"
15 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
16 17
17 namespace content { 18 namespace content {
18 19
19 class SharedWorkerInstanceTest : public testing::Test { 20 class SharedWorkerInstanceTest : public testing::Test {
20 protected: 21 protected:
21 SharedWorkerInstanceTest() 22 SharedWorkerInstanceTest()
22 : browser_context_(new TestBrowserContext()), 23 : browser_context_(new TestBrowserContext()),
23 partition_( 24 partition_(new WorkerStoragePartition(
24 new WorkerStoragePartition(browser_context_->GetRequestContext(), 25 BrowserContext::GetDefaultStoragePartition(browser_context_.get())->
25 NULL, 26 GetURLRequestContext(),
26 NULL, 27 NULL,
27 NULL, 28 NULL,
28 NULL, 29 NULL,
29 NULL, 30 NULL,
30 NULL, 31 NULL,
31 NULL)), 32 NULL,
33 NULL)),
32 partition_id_(*partition_.get()) {} 34 partition_id_(*partition_.get()) {}
33 35
34 bool Matches(const SharedWorkerInstance& instance, 36 bool Matches(const SharedWorkerInstance& instance,
35 const std::string& url, 37 const std::string& url,
36 const base::StringPiece& name) { 38 const base::StringPiece& name) {
37 return instance.Matches(GURL(url), 39 return instance.Matches(GURL(url),
38 base::ASCIIToUTF16(name), 40 base::ASCIIToUTF16(name),
39 partition_id_, 41 partition_id_,
40 browser_context_->GetResourceContext()); 42 browser_context_->GetResourceContext());
41 } 43 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 base::string16(), blink::WebContentSecurityPolicyTypeReport, 91 base::string16(), blink::WebContentSecurityPolicyTypeReport,
90 static_cast<blink::WebAddressSpace>(i), 92 static_cast<blink::WebAddressSpace>(i),
91 browser_context_->GetResourceContext(), partition_id_, 93 browser_context_->GetResourceContext(), partition_id_,
92 blink::WebSharedWorkerCreationContextTypeNonsecure); 94 blink::WebSharedWorkerCreationContextTypeNonsecure);
93 EXPECT_EQ(static_cast<blink::WebAddressSpace>(i), 95 EXPECT_EQ(static_cast<blink::WebAddressSpace>(i),
94 instance.creation_address_space()); 96 instance.creation_address_space());
95 } 97 }
96 } 98 }
97 99
98 } // namespace content 100 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698