| 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 <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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |