OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/plugin_service_impl.h" | 5 #include "content/browser/plugin_service_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 | 174 |
175 // A strict mock that fails if any of the methods are called. They shouldn't be | 175 // A strict mock that fails if any of the methods are called. They shouldn't be |
176 // called since the request should get canceled before then. | 176 // called since the request should get canceled before then. |
177 class MockCanceledPluginServiceClient : public PluginProcessHost::Client { | 177 class MockCanceledPluginServiceClient : public PluginProcessHost::Client { |
178 public: | 178 public: |
179 MockCanceledPluginServiceClient(ResourceContext* context) | 179 MockCanceledPluginServiceClient(ResourceContext* context) |
180 : context_(context), | 180 : context_(context), |
181 get_resource_context_called_(false) { | 181 get_resource_context_called_(false) { |
182 } | 182 } |
183 | 183 |
184 virtual ~MockCanceledPluginServiceClient() {} | 184 ~MockCanceledPluginServiceClient() override {} |
185 | 185 |
186 // Client implementation. | 186 // Client implementation. |
187 MOCK_METHOD0(ID, int()); | 187 MOCK_METHOD0(ID, int()); |
188 virtual ResourceContext* GetResourceContext() override { | 188 ResourceContext* GetResourceContext() override { |
189 get_resource_context_called_ = true; | 189 get_resource_context_called_ = true; |
190 return context_; | 190 return context_; |
191 } | 191 } |
192 MOCK_METHOD0(OffTheRecord, bool()); | 192 MOCK_METHOD0(OffTheRecord, bool()); |
193 MOCK_METHOD1(OnFoundPluginProcessHost, void(PluginProcessHost* host)); | 193 MOCK_METHOD1(OnFoundPluginProcessHost, void(PluginProcessHost* host)); |
194 MOCK_METHOD0(OnSentPluginChannelRequest, void()); | 194 MOCK_METHOD0(OnSentPluginChannelRequest, void()); |
195 MOCK_METHOD1(OnChannelOpened, void(const IPC::ChannelHandle& handle)); | 195 MOCK_METHOD1(OnChannelOpened, void(const IPC::ChannelHandle& handle)); |
196 MOCK_METHOD1(SetPluginInfo, void(const WebPluginInfo& info)); | 196 MOCK_METHOD1(SetPluginInfo, void(const WebPluginInfo& info)); |
197 MOCK_METHOD0(OnError, void()); | 197 MOCK_METHOD0(OnError, void()); |
198 | 198 |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 BrowserThread::IO, FROM_HERE, | 360 BrowserThread::IO, FROM_HERE, |
361 base::Bind(&OpenChannel, &mock_client)); | 361 base::Bind(&OpenChannel, &mock_client)); |
362 RunMessageLoop(); | 362 RunMessageLoop(); |
363 EXPECT_TRUE(mock_client.get_resource_context_called()); | 363 EXPECT_TRUE(mock_client.get_resource_context_called()); |
364 EXPECT_TRUE(mock_client.set_plugin_info_called()); | 364 EXPECT_TRUE(mock_client.set_plugin_info_called()); |
365 EXPECT_TRUE(mock_client.on_found_plugin_process_host_called()); | 365 EXPECT_TRUE(mock_client.on_found_plugin_process_host_called()); |
366 EXPECT_TRUE(mock_client.on_sent_plugin_channel_request_called()); | 366 EXPECT_TRUE(mock_client.on_sent_plugin_channel_request_called()); |
367 } | 367 } |
368 | 368 |
369 } // namespace content | 369 } // namespace content |
OLD | NEW |