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

Side by Side Diff: chrome/browser/extensions/extension_protocols_unittest.cc

Issue 2783113002: nit: Pass ownership of CVDelegate to ContentVerifier using unique_ptr. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_system_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 net::URLRequestContext* request_context = 189 net::URLRequestContext* request_context =
190 resource_context_.GetRequestContext(); 190 resource_context_.GetRequestContext();
191 old_factory_ = request_context->job_factory(); 191 old_factory_ = request_context->job_factory();
192 192
193 // Set up content verification. 193 // Set up content verification.
194 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 194 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
195 command_line->AppendSwitchASCII( 195 command_line->AppendSwitchASCII(
196 switches::kExtensionContentVerification, 196 switches::kExtensionContentVerification,
197 switches::kExtensionContentVerificationEnforce); 197 switches::kExtensionContentVerificationEnforce);
198 content_verifier_ = new ContentVerifier( 198 content_verifier_ = new ContentVerifier(
199 testing_profile_.get(), 199 testing_profile_.get(), base::MakeUnique<ChromeContentVerifierDelegate>(
200 new ChromeContentVerifierDelegate(testing_profile_.get())); 200 testing_profile_.get()));
201 extension_info_map_->SetContentVerifier(content_verifier_.get()); 201 extension_info_map_->SetContentVerifier(content_verifier_.get());
202 } 202 }
203 203
204 void TearDown() override { 204 void TearDown() override {
205 net::URLRequestContext* request_context = 205 net::URLRequestContext* request_context =
206 resource_context_.GetRequestContext(); 206 resource_context_.GetRequestContext();
207 request_context->set_job_factory(old_factory_); 207 request_context->set_job_factory(old_factory_);
208 content_verifier_->Shutdown(); 208 content_verifier_->Shutdown();
209 } 209 }
210 210
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 content_verifier_->OnExtensionLoaded(testing_profile_.get(), extension.get()); 593 content_verifier_->OnExtensionLoaded(testing_profile_.get(), extension.get());
594 // Wait for PostTask to ContentVerifierIOData::AddData() to finish. 594 // Wait for PostTask to ContentVerifierIOData::AddData() to finish.
595 content::RunAllPendingInMessageLoop(); 595 content::RunAllPendingInMessageLoop();
596 596
597 // Request foo.js. 597 // Request foo.js.
598 EXPECT_EQ(net::OK, DoRequest(*extension, kFooJs)); 598 EXPECT_EQ(net::OK, DoRequest(*extension, kFooJs));
599 test_job_delegate.WaitForDoneReading(extension->id()); 599 test_job_delegate.WaitForDoneReading(extension->id());
600 } 600 }
601 601
602 } // namespace extensions 602 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_system_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698