| 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 #include <utility> |
| 9 | 10 |
| 10 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 11 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
| 12 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/ptr_util.h" |
| 13 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
| 14 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
| 15 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
| 16 #include "base/test/test_file_util.h" | 18 #include "base/test/test_file_util.h" |
| 17 #include "base/values.h" | 19 #include "base/values.h" |
| 18 #include "chrome/browser/extensions/chrome_content_verifier_delegate.h" | 20 #include "chrome/browser/extensions/chrome_content_verifier_delegate.h" |
| 19 #include "chrome/common/chrome_paths.h" | 21 #include "chrome/common/chrome_paths.h" |
| 20 #include "chrome/common/chrome_switches.h" | 22 #include "chrome/common/chrome_switches.h" |
| 21 #include "chrome/test/base/testing_profile.h" | 23 #include "chrome/test/base/testing_profile.h" |
| 22 #include "components/crx_file/id_util.h" | 24 #include "components/crx_file/id_util.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 Extension::NO_FLAGS, &error)); | 98 Extension::NO_FLAGS, &error)); |
| 97 EXPECT_TRUE(extension.get()) << error; | 99 EXPECT_TRUE(extension.get()) << error; |
| 98 return extension; | 100 return extension; |
| 99 } | 101 } |
| 100 | 102 |
| 101 scoped_refptr<Extension> CreateTestResponseHeaderExtension() { | 103 scoped_refptr<Extension> CreateTestResponseHeaderExtension() { |
| 102 base::DictionaryValue manifest; | 104 base::DictionaryValue manifest; |
| 103 manifest.SetString("name", "An extension with web-accessible resources"); | 105 manifest.SetString("name", "An extension with web-accessible resources"); |
| 104 manifest.SetString("version", "2"); | 106 manifest.SetString("version", "2"); |
| 105 | 107 |
| 106 base::ListValue* web_accessible_list = new base::ListValue(); | 108 auto web_accessible_list = base::MakeUnique<base::ListValue>(); |
| 107 web_accessible_list->AppendString("test.dat"); | 109 web_accessible_list->AppendString("test.dat"); |
| 108 manifest.Set("web_accessible_resources", web_accessible_list); | 110 manifest.Set("web_accessible_resources", std::move(web_accessible_list)); |
| 109 | 111 |
| 110 base::FilePath path = GetTestPath("response_headers"); | 112 base::FilePath path = GetTestPath("response_headers"); |
| 111 | 113 |
| 112 std::string error; | 114 std::string error; |
| 113 scoped_refptr<Extension> extension( | 115 scoped_refptr<Extension> extension( |
| 114 Extension::Create(path, Manifest::UNPACKED, manifest, | 116 Extension::Create(path, Manifest::UNPACKED, manifest, |
| 115 Extension::NO_FLAGS, &error)); | 117 Extension::NO_FLAGS, &error)); |
| 116 EXPECT_TRUE(extension.get()) << error; | 118 EXPECT_TRUE(extension.get()) << error; |
| 117 return extension; | 119 return extension; |
| 118 } | 120 } |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 content_verifier_->OnExtensionLoaded(testing_profile_.get(), extension.get()); | 598 content_verifier_->OnExtensionLoaded(testing_profile_.get(), extension.get()); |
| 597 // Wait for PostTask to ContentVerifierIOData::AddData() to finish. | 599 // Wait for PostTask to ContentVerifierIOData::AddData() to finish. |
| 598 content::RunAllPendingInMessageLoop(); | 600 content::RunAllPendingInMessageLoop(); |
| 599 | 601 |
| 600 // Request foo.js. | 602 // Request foo.js. |
| 601 EXPECT_EQ(net::OK, DoRequest(*extension, kFooJs)); | 603 EXPECT_EQ(net::OK, DoRequest(*extension, kFooJs)); |
| 602 test_job_delegate.WaitForDoneReading(extension->id()); | 604 test_job_delegate.WaitForDoneReading(extension->id()); |
| 603 } | 605 } |
| 604 | 606 |
| 605 } // namespace extensions | 607 } // namespace extensions |
| OLD | NEW |