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/public/test/mock_render_process_host.h" | 5 #include "content/public/test/mock_render_process_host.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "content/common/frame_messages.h" | 23 #include "content/common/frame_messages.h" |
24 #include "content/common/renderer.mojom.h" | 24 #include "content/common/renderer.mojom.h" |
25 #include "content/public/browser/browser_context.h" | 25 #include "content/public/browser/browser_context.h" |
26 #include "content/public/browser/global_request_id.h" | 26 #include "content/public/browser/global_request_id.h" |
27 #include "content/public/browser/notification_details.h" | 27 #include "content/public/browser/notification_details.h" |
28 #include "content/public/browser/notification_service.h" | 28 #include "content/public/browser/notification_service.h" |
29 #include "content/public/browser/notification_source.h" | 29 #include "content/public/browser/notification_source.h" |
30 #include "content/public/browser/notification_types.h" | 30 #include "content/public/browser/notification_types.h" |
31 #include "content/public/browser/render_widget_host_iterator.h" | 31 #include "content/public/browser/render_widget_host_iterator.h" |
32 #include "content/public/browser/storage_partition.h" | 32 #include "content/public/browser/storage_partition.h" |
| 33 #include "content/public/common/service_manager_connection.h" |
33 #include "media/media_features.h" | 34 #include "media/media_features.h" |
34 #include "mojo/public/cpp/bindings/associated_interface_ptr.h" | 35 #include "mojo/public/cpp/bindings/associated_interface_ptr.h" |
| 36 #include "services/resource_coordinator/public/interfaces/coordination_unit.mojo
m.h" |
35 | 37 |
36 namespace content { | 38 namespace content { |
37 | 39 |
38 MockRenderProcessHost::MockRenderProcessHost(BrowserContext* browser_context) | 40 MockRenderProcessHost::MockRenderProcessHost(BrowserContext* browser_context) |
39 : bad_msg_count_(0), | 41 : bad_msg_count_(0), |
40 factory_(NULL), | 42 factory_(NULL), |
41 id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()), | 43 id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()), |
42 has_connection_(false), | 44 has_connection_(false), |
43 browser_context_(browser_context), | 45 browser_context_(browser_context), |
44 prev_routing_id_(0), | 46 prev_routing_id_(0), |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 mojom::Renderer* MockRenderProcessHost::GetRendererInterface() { | 342 mojom::Renderer* MockRenderProcessHost::GetRendererInterface() { |
341 if (!renderer_interface_) { | 343 if (!renderer_interface_) { |
342 renderer_interface_.reset(new mojom::RendererAssociatedPtr); | 344 renderer_interface_.reset(new mojom::RendererAssociatedPtr); |
343 mojo::MakeIsolatedRequest(renderer_interface_.get()); | 345 mojo::MakeIsolatedRequest(renderer_interface_.get()); |
344 } | 346 } |
345 return renderer_interface_->get(); | 347 return renderer_interface_->get(); |
346 } | 348 } |
347 | 349 |
348 resource_coordinator::ResourceCoordinatorInterface* | 350 resource_coordinator::ResourceCoordinatorInterface* |
349 MockRenderProcessHost::GetProcessResourceCoordinator() { | 351 MockRenderProcessHost::GetProcessResourceCoordinator() { |
350 NOTREACHED(); | 352 if (!process_resource_coordinator_) { |
351 return nullptr; | 353 service_manager::Connector* connector = |
| 354 content::ServiceManagerConnection::GetForProcess()->GetConnector(); |
| 355 process_resource_coordinator_ = |
| 356 base::MakeUnique<resource_coordinator::ResourceCoordinatorInterface>( |
| 357 connector, resource_coordinator::CoordinationUnitType::kProcess); |
| 358 } |
| 359 return process_resource_coordinator_.get(); |
352 } | 360 } |
353 | 361 |
354 void MockRenderProcessHost::SetIsNeverSuitableForReuse() { | 362 void MockRenderProcessHost::SetIsNeverSuitableForReuse() { |
355 NOTREACHED(); | 363 NOTREACHED(); |
356 } | 364 } |
357 | 365 |
358 bool MockRenderProcessHost::MayReuseHost() { | 366 bool MockRenderProcessHost::MayReuseHost() { |
359 return true; | 367 return true; |
360 } | 368 } |
361 | 369 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 for (auto it = processes_.begin(); it != processes_.end(); ++it) { | 451 for (auto it = processes_.begin(); it != processes_.end(); ++it) { |
444 if (it->get() == host) { | 452 if (it->get() == host) { |
445 it->release(); | 453 it->release(); |
446 processes_.erase(it); | 454 processes_.erase(it); |
447 break; | 455 break; |
448 } | 456 } |
449 } | 457 } |
450 } | 458 } |
451 | 459 |
452 } // namespace content | 460 } // namespace content |
OLD | NEW |