| 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" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
| 14 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
| 15 #include "base/threading/thread_task_runner_handle.h" | 15 #include "base/threading/thread_task_runner_handle.h" |
| 16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 17 #include "content/browser/devtools/shared_worker_devtools_manager.h" | 17 #include "content/browser/devtools/shared_worker_devtools_manager.h" |
| 18 #include "content/browser/shared_worker/shared_worker_instance.h" | 18 #include "content/browser/shared_worker/shared_worker_instance.h" |
| 19 #include "content/browser/shared_worker/worker_storage_partition.h" | 19 #include "content/browser/shared_worker/worker_storage_partition.h" |
| 20 #include "content/common/view_messages.h" | 20 #include "content/common/view_messages.h" |
| 21 #include "content/public/browser/browser_context.h" | 21 #include "content/public/browser/browser_context.h" |
| 22 #include "content/public/browser/content_browser_client.h" | 22 #include "content/public/browser/content_browser_client.h" |
| 23 #include "content/public/browser/devtools_agent_host.h" | 23 #include "content/public/browser/devtools_agent_host.h" |
| 24 #include "content/public/browser/devtools_external_agent_proxy.h" | 24 #include "content/public/browser/devtools_external_agent_proxy.h" |
| 25 #include "content/public/browser/devtools_external_agent_proxy_delegate.h" | 25 #include "content/public/browser/devtools_external_agent_proxy_delegate.h" |
| 26 #include "content/public/browser/web_contents_delegate.h" | 26 #include "content/public/browser/web_contents_delegate.h" |
| 27 #include "content/public/common/browser_side_navigation_policy.h" |
| 27 #include "content/public/test/test_utils.h" | 28 #include "content/public/test/test_utils.h" |
| 28 #include "content/test/test_content_browser_client.h" | 29 #include "content/test/test_content_browser_client.h" |
| 29 #include "content/test/test_render_view_host.h" | 30 #include "content/test/test_render_view_host.h" |
| 30 #include "content/test/test_web_contents.h" | 31 #include "content/test/test_web_contents.h" |
| 31 #include "testing/gtest/include/gtest/gtest.h" | 32 #include "testing/gtest/include/gtest/gtest.h" |
| 32 | 33 |
| 33 using base::TimeDelta; | 34 using base::TimeDelta; |
| 34 | 35 |
| 35 namespace content { | 36 namespace content { |
| 36 namespace { | 37 namespace { |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 167 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 167 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), | 168 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), |
| 168 TimeDelta::FromMilliseconds(10)); | 169 TimeDelta::FromMilliseconds(10)); |
| 169 base::RunLoop().Run(); | 170 base::RunLoop().Run(); |
| 170 EXPECT_TRUE(delegate.renderer_unresponsive_received()); | 171 EXPECT_TRUE(delegate.renderer_unresponsive_received()); |
| 171 | 172 |
| 172 contents()->SetDelegate(NULL); | 173 contents()->SetDelegate(NULL); |
| 173 } | 174 } |
| 174 | 175 |
| 175 TEST_F(DevToolsManagerTest, ReattachOnCancelPendingNavigation) { | 176 TEST_F(DevToolsManagerTest, ReattachOnCancelPendingNavigation) { |
| 177 // This test triggers incorrect notifications with PlzNavigate. |
| 178 if (IsBrowserSideNavigationEnabled()) |
| 179 return; |
| 176 // Navigate to URL. First URL should use first RenderViewHost. | 180 // Navigate to URL. First URL should use first RenderViewHost. |
| 177 const GURL url("http://www.google.com"); | 181 const GURL url("http://www.google.com"); |
| 178 controller().LoadURL( | 182 controller().LoadURL( |
| 179 url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); | 183 url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
| 180 int pending_id = controller().GetPendingEntry()->GetUniqueID(); | 184 int pending_id = controller().GetPendingEntry()->GetUniqueID(); |
| 181 contents()->GetMainFrame()->PrepareForCommit(); | 185 contents()->GetMainFrame()->PrepareForCommit(); |
| 182 contents()->TestDidNavigate(contents()->GetMainFrame(), pending_id, true, | 186 contents()->TestDidNavigate(contents()->GetMainFrame(), pending_id, true, |
| 183 url, ui::PAGE_TRANSITION_TYPED); | 187 url, ui::PAGE_TRANSITION_TYPED); |
| 184 contents()->GetMainFrame()->SimulateNavigationStop(); | 188 contents()->GetMainFrame()->SimulateNavigationStop(); |
| 185 EXPECT_FALSE(contents()->CrossProcessNavigationPending()); | 189 EXPECT_FALSE(contents()->CrossProcessNavigationPending()); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 TestDevToolsClientHost client_host; | 273 TestDevToolsClientHost client_host; |
| 270 client_host.InspectAgentHost(agent_host.get()); | 274 client_host.InspectAgentHost(agent_host.get()); |
| 271 agent_host->DispatchProtocolMessage(&client_host, "message1"); | 275 agent_host->DispatchProtocolMessage(&client_host, "message1"); |
| 272 agent_host->DispatchProtocolMessage(&client_host, "message2"); | 276 agent_host->DispatchProtocolMessage(&client_host, "message2"); |
| 273 agent_host->DispatchProtocolMessage(&client_host, "message2"); | 277 agent_host->DispatchProtocolMessage(&client_host, "message2"); |
| 274 | 278 |
| 275 client_host.Close(); | 279 client_host.Close(); |
| 276 } | 280 } |
| 277 | 281 |
| 278 } // namespace content | 282 } // namespace content |
| OLD | NEW |