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