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 "content/browser/loader/mime_sniffing_resource_handler.h" | 5 #include "content/browser/loader/mime_sniffing_resource_handler.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> |
10 | 11 |
11 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
12 #include "base/location.h" | 13 #include "base/location.h" |
13 #include "base/logging.h" | 14 #include "base/logging.h" |
14 #include "base/macros.h" | 15 #include "base/macros.h" |
15 #include "base/memory/ptr_util.h" | 16 #include "base/memory/ptr_util.h" |
16 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
17 #include "base/threading/thread_task_runner_handle.h" | 18 #include "base/threading/thread_task_runner_handle.h" |
18 #include "content/browser/loader/intercepting_resource_handler.h" | 19 #include "content/browser/loader/intercepting_resource_handler.h" |
19 #include "content/browser/loader/mock_resource_loader.h" | 20 #include "content/browser/loader/mock_resource_loader.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 std::string* actual_mime_type) override { | 135 std::string* actual_mime_type) override { |
135 *is_stale = is_plugin_stale_; | 136 *is_stale = is_plugin_stale_; |
136 if (!is_plugin_stale_ || !plugin_available_) | 137 if (!is_plugin_stale_ || !plugin_available_) |
137 return false; | 138 return false; |
138 info->type = WebPluginInfo::PLUGIN_TYPE_BROWSER_PLUGIN; | 139 info->type = WebPluginInfo::PLUGIN_TYPE_BROWSER_PLUGIN; |
139 info->path = base::FilePath::FromUTF8Unsafe( | 140 info->path = base::FilePath::FromUTF8Unsafe( |
140 std::string("chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/")); | 141 std::string("chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/")); |
141 return true; | 142 return true; |
142 } | 143 } |
143 | 144 |
144 void GetPlugins(const GetPluginsCallback& callback) override { | 145 void GetPlugins(GetPluginsCallback callback) override { |
145 is_plugin_stale_ = false; | 146 is_plugin_stale_ = false; |
146 std::vector<WebPluginInfo> plugins; | 147 std::vector<WebPluginInfo> plugins; |
147 base::ThreadTaskRunnerHandle::Get()->PostTask( | 148 base::ThreadTaskRunnerHandle::Get()->PostTask( |
148 FROM_HERE, base::Bind(callback, plugins)); | 149 FROM_HERE, base::BindOnce(std::move(callback), plugins)); |
149 } | 150 } |
150 | 151 |
151 private: | 152 private: |
152 const bool plugin_available_; | 153 const bool plugin_available_; |
153 bool is_plugin_stale_; | 154 bool is_plugin_stale_; |
154 | 155 |
155 DISALLOW_COPY_AND_ASSIGN(TestFakePluginService); | 156 DISALLOW_COPY_AND_ASSIGN(TestFakePluginService); |
156 }; | 157 }; |
157 | 158 |
158 } // namespace | 159 } // namespace |
(...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
960 // on OnResponseStarted. | 961 // on OnResponseStarted. |
961 EXPECT_EQ(MockResourceLoader::Status::CANCELED, | 962 EXPECT_EQ(MockResourceLoader::Status::CANCELED, |
962 mock_loader.OnResponseStarted(std::move(response))); | 963 mock_loader.OnResponseStarted(std::move(response))); |
963 EXPECT_EQ(net::ERR_ABORTED, mock_loader.error_code()); | 964 EXPECT_EQ(net::ERR_ABORTED, mock_loader.error_code()); |
964 | 965 |
965 // Process all messages to ensure proper test teardown. | 966 // Process all messages to ensure proper test teardown. |
966 content::RunAllPendingInMessageLoop(); | 967 content::RunAllPendingInMessageLoop(); |
967 } | 968 } |
968 | 969 |
969 } // namespace content | 970 } // namespace content |
OLD | NEW |