| 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "base/time.h" | 7 #include "base/time.h" |
| 8 #include "content/browser/devtools/devtools_manager_impl.h" | 8 #include "content/browser/devtools/devtools_manager_impl.h" |
| 9 #include "content/browser/devtools/render_view_devtools_agent_host.h" | 9 #include "content/browser/devtools/render_view_devtools_agent_host.h" |
| 10 #include "content/browser/renderer_host/test_render_view_host.h" | 10 #include "content/browser/renderer_host/test_render_view_host.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 105 |
| 106 } // namespace | 106 } // namespace |
| 107 | 107 |
| 108 class DevToolsManagerTest : public RenderViewHostImplTestHarness { | 108 class DevToolsManagerTest : public RenderViewHostImplTestHarness { |
| 109 public: | 109 public: |
| 110 DevToolsManagerTest() { | 110 DevToolsManagerTest() { |
| 111 } | 111 } |
| 112 | 112 |
| 113 protected: | 113 protected: |
| 114 virtual void SetUp() OVERRIDE { | 114 virtual void SetUp() OVERRIDE { |
| 115 original_browser_client_ = GetContentClient()->browser(); | 115 original_browser_client_ = SetBrowserClientForTesting(&browser_client_); |
| 116 GetContentClient()->set_browser_for_testing(&browser_client_); | |
| 117 | 116 |
| 118 RenderViewHostImplTestHarness::SetUp(); | 117 RenderViewHostImplTestHarness::SetUp(); |
| 119 TestDevToolsClientHost::ResetCounters(); | 118 TestDevToolsClientHost::ResetCounters(); |
| 120 } | 119 } |
| 121 | 120 |
| 122 virtual void TearDown() OVERRIDE { | 121 virtual void TearDown() OVERRIDE { |
| 123 RenderViewHostImplTestHarness::TearDown(); | 122 RenderViewHostImplTestHarness::TearDown(); |
| 124 GetContentClient()->set_browser_for_testing(original_browser_client_); | 123 SetBrowserClientForTesting(original_browser_client_); |
| 125 } | 124 } |
| 126 | 125 |
| 127 private: | 126 private: |
| 128 ContentBrowserClient* original_browser_client_; | 127 ContentBrowserClient* original_browser_client_; |
| 129 DevToolsManagerTestBrowserClient browser_client_; | 128 DevToolsManagerTestBrowserClient browser_client_; |
| 130 }; | 129 }; |
| 131 | 130 |
| 132 TEST_F(DevToolsManagerTest, OpenAndManuallyCloseDevToolsClientHost) { | 131 TEST_F(DevToolsManagerTest, OpenAndManuallyCloseDevToolsClientHost) { |
| 133 DevToolsManager* manager = DevToolsManager::GetInstance(); | 132 DevToolsManager* manager = DevToolsManager::GetInstance(); |
| 134 | 133 |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 manager->RegisterDevToolsClientHostFor(agent_host, &client_host); | 282 manager->RegisterDevToolsClientHostFor(agent_host, &client_host); |
| 284 | 283 |
| 285 manager->DispatchOnInspectorBackend(&client_host, "message1"); | 284 manager->DispatchOnInspectorBackend(&client_host, "message1"); |
| 286 manager->DispatchOnInspectorBackend(&client_host, "message2"); | 285 manager->DispatchOnInspectorBackend(&client_host, "message2"); |
| 287 manager->DispatchOnInspectorBackend(&client_host, "message2"); | 286 manager->DispatchOnInspectorBackend(&client_host, "message2"); |
| 288 | 287 |
| 289 client_host.Close(manager); | 288 client_host.Close(manager); |
| 290 } | 289 } |
| 291 | 290 |
| 292 } // namespace content | 291 } // namespace content |
| OLD | NEW |