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