OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/ref_counted.h" | 5 #include "base/ref_counted.h" |
6 #include "chrome/browser/browser.h" | 6 #include "chrome/browser/browser.h" |
7 #include "chrome/browser/browser_list.h" | 7 #include "chrome/browser/browser_list.h" |
8 #include "chrome/browser/renderer_host/render_view_host.h" | 8 #include "chrome/browser/renderer_host/render_view_host.h" |
9 #include "chrome/browser/debugger/devtools_manager.h" | 9 #include "chrome/browser/debugger/devtools_manager.h" |
10 #include "chrome/browser/debugger/devtools_client_host.h" | 10 #include "chrome/browser/debugger/devtools_client_host.h" |
(...skipping 62 matching lines...) Loading... |
73 // Setting the events should have caused an ExtensionDevToolsBridge to be | 73 // Setting the events should have caused an ExtensionDevToolsBridge to be |
74 // registered for the tab's RenderViewHost. | 74 // registered for the tab's RenderViewHost. |
75 DevToolsClientHost* devtools_client_host = | 75 DevToolsClientHost* devtools_client_host = |
76 devtools_manager->GetDevToolsClientHostFor( | 76 devtools_manager->GetDevToolsClientHostFor( |
77 tab_contents->render_view_host()); | 77 tab_contents->render_view_host()); |
78 ASSERT_TRUE(devtools_client_host); | 78 ASSERT_TRUE(devtools_client_host); |
79 | 79 |
80 // Test onPageEvent event. | 80 // Test onPageEvent event. |
81 result = false; | 81 result = false; |
82 | 82 |
83 DevToolsMessageData message_data; | 83 DevToolsClientMsg_DispatchToAPU pageEventMessage(""); |
84 message_data.class_name = "ApuAgentDelegate"; | |
85 message_data.method_name = "dispatchToApu"; | |
86 message_data.arguments.push_back(""); | |
87 DevToolsClientMsg_RpcMessage pageEventMessage(message_data); | |
88 devtools_client_host->SendMessageToClient(pageEventMessage); | 84 devtools_client_host->SendMessageToClient(pageEventMessage); |
89 ui_test_utils::ExecuteJavaScriptAndExtractBool( | 85 ui_test_utils::ExecuteJavaScriptAndExtractBool( |
90 host->render_view_host(), L"", L"testReceivePageEvent()", &result); | 86 host->render_view_host(), L"", L"testReceivePageEvent()", &result); |
91 EXPECT_TRUE(result); | 87 EXPECT_TRUE(result); |
92 | 88 |
93 // Test onTabClose event. | 89 // Test onTabClose event. |
94 result = false; | 90 result = false; |
95 devtools_manager->UnregisterDevToolsClientHostFor( | 91 devtools_manager->UnregisterDevToolsClientHostFor( |
96 tab_contents->render_view_host()); | 92 tab_contents->render_view_host()); |
97 ui_test_utils::ExecuteJavaScriptAndExtractBool( | 93 ui_test_utils::ExecuteJavaScriptAndExtractBool( |
(...skipping 54 matching lines...) Loading... |
152 | 148 |
153 // Removing the listeners from the second extension should tear the bridge | 149 // Removing the listeners from the second extension should tear the bridge |
154 // down. | 150 // down. |
155 result = false; | 151 result = false; |
156 ui_test_utils::ExecuteJavaScriptAndExtractBool( | 152 ui_test_utils::ExecuteJavaScriptAndExtractBool( |
157 host_two->render_view_host(), L"", L"unregisterListeners()", &result); | 153 host_two->render_view_host(), L"", L"unregisterListeners()", &result); |
158 EXPECT_TRUE(result); | 154 EXPECT_TRUE(result); |
159 ASSERT_FALSE(devtools_manager->GetDevToolsClientHostFor( | 155 ASSERT_FALSE(devtools_manager->GetDevToolsClientHostFor( |
160 tab_contents->render_view_host())); | 156 tab_contents->render_view_host())); |
161 } | 157 } |
OLD | NEW |