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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/cancelable_callback.h" | 6 #include "base/cancelable_callback.h" |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 CloseDevToolsWindow(); | 615 CloseDevToolsWindow(); |
616 } | 616 } |
617 | 617 |
618 class DevToolsAgentHostTest : public InProcessBrowserTest {}; | 618 class DevToolsAgentHostTest : public InProcessBrowserTest {}; |
619 | 619 |
620 // Tests DevToolsAgentHost retention by its target. | 620 // Tests DevToolsAgentHost retention by its target. |
621 IN_PROC_BROWSER_TEST_F(DevToolsAgentHostTest, TestAgentHostReleased) { | 621 IN_PROC_BROWSER_TEST_F(DevToolsAgentHostTest, TestAgentHostReleased) { |
622 ui_test_utils::NavigateToURL(browser(), GURL("about:blank")); | 622 ui_test_utils::NavigateToURL(browser(), GURL("about:blank")); |
623 RenderViewHost* rvh = browser()->tab_strip_model()->GetWebContentsAt(0)-> | 623 RenderViewHost* rvh = browser()->tab_strip_model()->GetWebContentsAt(0)-> |
624 GetRenderViewHost(); | 624 GetRenderViewHost(); |
625 DevToolsAgentHost* agent_raw = DevToolsAgentHost::GetOrCreateFor(rvh); | 625 DevToolsAgentHost* agent_raw = DevToolsAgentHost::GetOrCreateFor(rvh).get(); |
626 const std::string agent_id = agent_raw->GetId(); | 626 const std::string agent_id = agent_raw->GetId(); |
627 ASSERT_EQ(agent_raw, DevToolsAgentHost::GetForId(agent_id)) << | 627 ASSERT_EQ(agent_raw, DevToolsAgentHost::GetForId(agent_id)) << |
628 "DevToolsAgentHost cannot be found by id"; | 628 "DevToolsAgentHost cannot be found by id"; |
629 browser()->tab_strip_model()-> | 629 browser()->tab_strip_model()-> |
630 CloseWebContentsAt(0, TabStripModel::CLOSE_NONE); | 630 CloseWebContentsAt(0, TabStripModel::CLOSE_NONE); |
631 ASSERT_FALSE(DevToolsAgentHost::GetForId(agent_id)) << | 631 ASSERT_FALSE(DevToolsAgentHost::GetForId(agent_id).get()) |
632 "DevToolsAgentHost is not released when the tab is closed"; | 632 << "DevToolsAgentHost is not released when the tab is closed"; |
633 } | 633 } |
634 | 634 |
635 class RemoteDebuggingTest: public ExtensionApiTest { | 635 class RemoteDebuggingTest: public ExtensionApiTest { |
636 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 636 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
637 ExtensionApiTest::SetUpCommandLine(command_line); | 637 ExtensionApiTest::SetUpCommandLine(command_line); |
638 command_line->AppendSwitchASCII(switches::kRemoteDebuggingPort, "9222"); | 638 command_line->AppendSwitchASCII(switches::kRemoteDebuggingPort, "9222"); |
639 | 639 |
640 // Override the extension root path. | 640 // Override the extension root path. |
641 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir_); | 641 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir_); |
642 test_data_dir_ = test_data_dir_.AppendASCII("devtools"); | 642 test_data_dir_ = test_data_dir_.AppendASCII("devtools"); |
643 } | 643 } |
644 }; | 644 }; |
645 | 645 |
646 IN_PROC_BROWSER_TEST_F(RemoteDebuggingTest, RemoteDebugger) { | 646 IN_PROC_BROWSER_TEST_F(RemoteDebuggingTest, RemoteDebugger) { |
647 ASSERT_TRUE(RunExtensionTest("target_list")) << message_; | 647 ASSERT_TRUE(RunExtensionTest("target_list")) << message_; |
648 } | 648 } |
649 | 649 |
650 } // namespace | 650 } // namespace |
OLD | NEW |