| 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/devtools/devtools_manager.h" | 5 #include "content/browser/devtools/devtools_manager.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/guid.h" | 9 #include "base/guid.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 void expectEvent(int count, const std::string& name) { | 233 void expectEvent(int count, const std::string& name) { |
| 234 EXPECT_EQ(count, event_counter_[name]); | 234 EXPECT_EQ(count, event_counter_[name]); |
| 235 } | 235 } |
| 236 | 236 |
| 237 void Attach(DevToolsExternalAgentProxy* proxy) override { | 237 void Attach(DevToolsExternalAgentProxy* proxy) override { |
| 238 recordEvent("Attach"); | 238 recordEvent("Attach"); |
| 239 }; | 239 }; |
| 240 | 240 |
| 241 void Detach() override { recordEvent("Detach"); }; | 241 void Detach() override { recordEvent("Detach"); }; |
| 242 | 242 |
| 243 std::string GetType() override { return ""; } | 243 std::string GetType() override { return std::string(); } |
| 244 std::string GetTitle() override { return ""; } | 244 std::string GetTitle() override { return std::string(); } |
| 245 std::string GetDescription() override { return ""; } | 245 std::string GetDescription() override { return std::string(); } |
| 246 GURL GetURL() override { return GURL(); } | 246 GURL GetURL() override { return GURL(); } |
| 247 GURL GetFaviconURL() override { return GURL(); } | 247 GURL GetFaviconURL() override { return GURL(); } |
| 248 | 248 std::string GetFrontendURL() override { return std::string(); } |
| 249 bool Activate() override { return false; }; | 249 bool Activate() override { return false; }; |
| 250 bool Inspect() override { return false; }; | |
| 251 void Reload() override { }; | 250 void Reload() override { }; |
| 252 bool Close() override { return false; }; | 251 bool Close() override { return false; }; |
| 253 | 252 |
| 254 void SendMessageToBackend(const std::string& message) override { | 253 void SendMessageToBackend(const std::string& message) override { |
| 255 recordEvent(std::string("SendMessageToBackend.") + message); | 254 recordEvent(std::string("SendMessageToBackend.") + message); |
| 256 }; | 255 }; |
| 257 | 256 |
| 258 }; | 257 }; |
| 259 | 258 |
| 260 TEST_F(DevToolsManagerTest, TestExternalProxy) { | 259 TEST_F(DevToolsManagerTest, TestExternalProxy) { |
| 261 std::unique_ptr<TestExternalAgentDelegate> delegate( | 260 std::unique_ptr<TestExternalAgentDelegate> delegate( |
| 262 new TestExternalAgentDelegate()); | 261 new TestExternalAgentDelegate()); |
| 263 | 262 |
| 264 scoped_refptr<DevToolsAgentHost> agent_host = | 263 scoped_refptr<DevToolsAgentHost> agent_host = |
| 265 DevToolsAgentHost::Forward(base::GenerateGUID(), std::move(delegate)); | 264 DevToolsAgentHost::Forward(base::GenerateGUID(), std::move(delegate)); |
| 266 EXPECT_EQ(agent_host, DevToolsAgentHost::GetForId(agent_host->GetId())); | 265 EXPECT_EQ(agent_host, DevToolsAgentHost::GetForId(agent_host->GetId())); |
| 267 | 266 |
| 268 TestDevToolsClientHost client_host; | 267 TestDevToolsClientHost client_host; |
| 269 client_host.InspectAgentHost(agent_host.get()); | 268 client_host.InspectAgentHost(agent_host.get()); |
| 270 agent_host->DispatchProtocolMessage(&client_host, "message1"); | 269 agent_host->DispatchProtocolMessage(&client_host, "message1"); |
| 271 agent_host->DispatchProtocolMessage(&client_host, "message2"); | 270 agent_host->DispatchProtocolMessage(&client_host, "message2"); |
| 272 agent_host->DispatchProtocolMessage(&client_host, "message2"); | 271 agent_host->DispatchProtocolMessage(&client_host, "message2"); |
| 273 | 272 |
| 274 client_host.Close(); | 273 client_host.Close(); |
| 275 } | 274 } |
| 276 | 275 |
| 277 } // namespace content | 276 } // namespace content |
| OLD | NEW |