summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_devtools_browsertests.cc
diff options
context:
space:
mode:
authoryurys@chromium.org <yurys@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-01 16:21:44 +0000
committeryurys@chromium.org <yurys@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-01 16:21:44 +0000
commit0e12d7d59d4778e1a8ef692d244bf66aea1a80b8 (patch)
tree11fd0f2f8d0ab431f59084541922d6c971876f99 /chrome/browser/extensions/extension_devtools_browsertests.cc
parent5581458c8b7ac9e7117d96606d74e574c41df8d6 (diff)
downloadchromium_src-0e12d7d59d4778e1a8ef692d244bf66aea1a80b8.zip
chromium_src-0e12d7d59d4778e1a8ef692d244bf66aea1a80b8.tar.gz
chromium_src-0e12d7d59d4778e1a8ef692d244bf66aea1a80b8.tar.bz2
Define DevTools content API
The API consists of the following parts: * DevToolsManager routes messages between devtools agents and clients * DevToolsAgentHost provides an abstract interface to the debuggee, currently it is either RenderViewHost or Shared Worker. Client can obtain DevToolsAgentHost from DevToolsAgentHostRegistry. * DevToolsClientHost is an API that should be implemented by DevTools front-end. There is a default Chromium implementation living in chrome/ and a remote debugging server which also implements this interface. Clients can extend it in order to provide custom front-end. There is a default DevTools front-end implementation and content/ provides a way for creating corresponding DevToolsClientHost by means of DevToolsClientHost::CreateDevToolsFrontendHost. The embedder just needs to provide a concrete delegate. * This patch also removes DevToolsHost_ForwardToAgent and DevToolsHost_ForwardToClient IPC messages which were used to forward only one message. DevTools IPC messages are now hidden behind the devtools content API. BUG=104625 TEST=Existing tests Review URL: http://codereview.chromium.org/8549022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112473 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_devtools_browsertests.cc')
-rw-r--r--chrome/browser/extensions/extension_devtools_browsertests.cc33
1 files changed, 20 insertions, 13 deletions
diff --git a/chrome/browser/extensions/extension_devtools_browsertests.cc b/chrome/browser/extensions/extension_devtools_browsertests.cc
index 9f220b7..f41ebd3 100644
--- a/chrome/browser/extensions/extension_devtools_browsertests.cc
+++ b/chrome/browser/extensions/extension_devtools_browsertests.cc
@@ -16,14 +16,19 @@
#include "chrome/common/chrome_paths.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/ui_test_utils.h"
-#include "content/browser/debugger/devtools_client_host.h"
-#include "content/browser/debugger/devtools_manager.h"
#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/site_instance.h"
#include "content/browser/tab_contents/tab_contents.h"
-#include "content/common/devtools_messages.h"
+#include "content/public/browser/devtools_agent_host_registry.h"
+#include "content/public/browser/devtools_client_host.h"
+#include "content/public/browser/devtools_manager.h"
#include "net/base/net_util.h"
+using content::DevToolsAgentHost;
+using content::DevToolsAgentHostRegistry;
+using content::DevToolsClientHost;
+using content::DevToolsManager;
+
// Looks for an ExtensionHost whose URL has the given path component (including
// leading slash). Also verifies that the expected number of hosts are loaded.
static ExtensionHost* FindHostWithPath(ExtensionProcessManager* manager,
@@ -73,18 +78,16 @@ IN_PROC_BROWSER_TEST_F(ExtensionDevToolsBrowserTest, FLAKY_TimelineApi) {
// Setting the events should have caused an ExtensionDevToolsBridge to be
// registered for the tab's RenderViewHost.
+ DevToolsAgentHost* agent = DevToolsAgentHostRegistry::GetDevToolsAgentHost(
+ tab_contents->render_view_host());
DevToolsClientHost* devtools_client_host =
- devtools_manager->GetDevToolsClientHostFor(
- tab_contents->render_view_host());
+ devtools_manager->GetDevToolsClientHostFor(agent);
ASSERT_TRUE(devtools_client_host);
// Test onPageEvent event.
result = false;
- DevToolsClientMsg_DispatchOnInspectorFrontend pageEventMessage(
- MSG_ROUTING_NONE,
- "");
- devtools_client_host->SendMessageToClient(pageEventMessage);
+ devtools_client_host->DispatchOnInspectorFrontend("");
ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
host->render_view_host(), L"", L"testReceivePageEvent()", &result));
EXPECT_TRUE(result);
@@ -92,7 +95,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionDevToolsBrowserTest, FLAKY_TimelineApi) {
// Test onTabClose event.
result = false;
devtools_manager->UnregisterDevToolsClientHostFor(
- tab_contents->render_view_host());
+ DevToolsAgentHostRegistry::GetDevToolsAgentHost(
+ tab_contents->render_view_host()));
ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
host->render_view_host(), L"", L"testReceiveTabCloseEvent()", &result));
EXPECT_TRUE(result);
@@ -132,7 +136,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionDevToolsBrowserTest, ProcessRefCounting) {
// Setting the event listeners should have caused an ExtensionDevToolsBridge
// to be registered for the tab's RenderViewHost.
ASSERT_TRUE(devtools_manager->GetDevToolsClientHostFor(
- tab_contents->render_view_host()));
+ DevToolsAgentHostRegistry::GetDevToolsAgentHost(
+ tab_contents->render_view_host())));
// Register listeners from the second extension as well.
std::wstring script = base::StringPrintf(L"registerListenersForTab(%d)",
@@ -148,7 +153,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionDevToolsBrowserTest, ProcessRefCounting) {
host_one->render_view_host(), L"", L"unregisterListeners()", &result));
EXPECT_TRUE(result);
ASSERT_TRUE(devtools_manager->GetDevToolsClientHostFor(
- tab_contents->render_view_host()));
+ DevToolsAgentHostRegistry::GetDevToolsAgentHost(
+ tab_contents->render_view_host())));
// Removing the listeners from the second extension should tear the bridge
// down.
@@ -157,5 +163,6 @@ IN_PROC_BROWSER_TEST_F(ExtensionDevToolsBrowserTest, ProcessRefCounting) {
host_two->render_view_host(), L"", L"unregisterListeners()", &result));
EXPECT_TRUE(result);
ASSERT_FALSE(devtools_manager->GetDevToolsClientHostFor(
- tab_contents->render_view_host()));
+ DevToolsAgentHostRegistry::GetDevToolsAgentHost(
+ tab_contents->render_view_host())));
}