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/devtools/embedded_worker_devtools_manager.h" | 5 #include "content/browser/devtools/embedded_worker_devtools_manager.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "content/browser/browser_thread_impl.h" | 10 #include "content/browser/browser_thread_impl.h" |
11 #include "content/browser/devtools/devtools_agent_host_impl.h" | 11 #include "content/browser/devtools/devtools_agent_host_impl.h" |
12 #include "content/browser/devtools/embedded_worker_devtools_agent_host.h" | 12 #include "content/browser/devtools/embedded_worker_devtools_agent_host.h" |
13 #include "content/browser/shared_worker/shared_worker_instance.h" | 13 #include "content/browser/shared_worker/shared_worker_instance.h" |
14 #include "content/browser/shared_worker/worker_storage_partition.h" | 14 #include "content/browser/shared_worker/worker_storage_partition.h" |
15 #include "content/public/test/test_browser_context.h" | 15 #include "content/public/test/test_browser_context.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 namespace { | 19 namespace { |
20 | 20 |
21 class TestDevToolsClientHost : public DevToolsAgentHostClient { | 21 class TestDevToolsClientHost : public DevToolsAgentHostClient { |
22 public: | 22 public: |
23 TestDevToolsClientHost() {} | 23 TestDevToolsClientHost() {} |
24 virtual ~TestDevToolsClientHost() {} | 24 ~TestDevToolsClientHost() override {} |
25 virtual void DispatchProtocolMessage( | 25 void DispatchProtocolMessage(DevToolsAgentHost* agent_host, |
26 DevToolsAgentHost* agent_host, const std::string& message) override {} | 26 const std::string& message) override {} |
27 virtual void AgentHostClosed( | 27 void AgentHostClosed(DevToolsAgentHost* agent_host, bool replaced) override {} |
28 DevToolsAgentHost* agent_host, bool replaced) override {} | |
29 | 28 |
30 void InspectAgentHost(DevToolsAgentHost* agent_host) { | 29 void InspectAgentHost(DevToolsAgentHost* agent_host) { |
31 if (agent_host_.get()) | 30 if (agent_host_.get()) |
32 agent_host_->DetachClient(); | 31 agent_host_->DetachClient(); |
33 agent_host_ = agent_host; | 32 agent_host_ = agent_host; |
34 if (agent_host_.get()) | 33 if (agent_host_.get()) |
35 agent_host_->AttachClient(this); | 34 agent_host_->AttachClient(this); |
36 } | 35 } |
37 private: | 36 private: |
38 scoped_refptr<DevToolsAgentHost> agent_host_; | 37 scoped_refptr<DevToolsAgentHost> agent_host_; |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 manager_->SharedWorkerCreated(3, 2, instance); | 289 manager_->SharedWorkerCreated(3, 2, instance); |
291 CheckWorkerState(3, 2, WorkerState::WORKER_UNINSPECTED); | 290 CheckWorkerState(3, 2, WorkerState::WORKER_UNINSPECTED); |
292 agent_host = NULL; | 291 agent_host = NULL; |
293 CheckWorkerState(3, 2, WorkerState::WORKER_UNINSPECTED); | 292 CheckWorkerState(3, 2, WorkerState::WORKER_UNINSPECTED); |
294 manager_->WorkerDestroyed(3, 2); | 293 manager_->WorkerDestroyed(3, 2); |
295 CheckWorkerNotExist(3, 2); | 294 CheckWorkerNotExist(3, 2); |
296 CheckWorkerCount(0); | 295 CheckWorkerCount(0); |
297 } | 296 } |
298 | 297 |
299 } // namespace content | 298 } // namespace content |
OLD | NEW |