OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "third_party/WebKit/Source/Platform/chromium/public/WebString.h" | 5 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" |
6 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDevToolsAgent.h" | 6 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDevToolsAgent.h" |
7 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDevToolsFrontend.h
" | 7 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDevToolsFrontend.h
" |
8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h" | 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h" |
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
11 | 11 |
12 #undef LOG | 12 #undef LOG |
13 #include "webkit/tools/test_shell/test_shell_devtools_agent.h" | 13 #include "webkit/tools/test_shell/test_shell_devtools_agent.h" |
14 #include "webkit/tools/test_shell/test_shell_devtools_callargs.h" | 14 #include "webkit/tools/test_shell/test_shell_devtools_callargs.h" |
15 #include "webkit/tools/test_shell/test_shell_devtools_client.h" | 15 #include "webkit/tools/test_shell/test_shell_devtools_client.h" |
16 | 16 |
17 #include "base/bind.h" | 17 #include "base/bind.h" |
18 #include "base/command_line.h" | 18 #include "base/command_line.h" |
19 #include "base/message_loop.h" | 19 #include "base/message_loop.h" |
20 | 20 |
21 using WebKit::WebDevToolsAgent; | 21 using WebKit::WebDevToolsAgent; |
22 using WebKit::WebDevToolsFrontend; | 22 using WebKit::WebDevToolsFrontend; |
23 using WebKit::WebDevToolsMessageData; | 23 using WebKit::WebDevToolsMessageData; |
24 using WebKit::WebString; | 24 using WebKit::WebString; |
25 using WebKit::WebView; | 25 using WebKit::WebView; |
26 | 26 |
27 TestShellDevToolsClient::TestShellDevToolsClient(TestShellDevToolsAgent *agent, | 27 TestShellDevToolsClient::TestShellDevToolsClient(TestShellDevToolsAgent *agent, |
28 WebView* web_view) | 28 WebView* web_view) |
29 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), | 29 : weak_factory_(this), |
30 dev_tools_agent_(agent), | 30 dev_tools_agent_(agent), |
31 web_view_(web_view) { | 31 web_view_(web_view) { |
32 web_tools_frontend_.reset(WebDevToolsFrontend::create(web_view_, this, | 32 web_tools_frontend_.reset(WebDevToolsFrontend::create(web_view_, this, |
33 WebString::fromUTF8("en-US"))); | 33 WebString::fromUTF8("en-US"))); |
34 dev_tools_agent_->attach(this); | 34 dev_tools_agent_->attach(this); |
35 } | 35 } |
36 | 36 |
37 TestShellDevToolsClient::~TestShellDevToolsClient() { | 37 TestShellDevToolsClient::~TestShellDevToolsClient() { |
38 // It is a chance that page will be destroyed at detach step of | 38 // It is a chance that page will be destroyed at detach step of |
39 // dev_tools_agent_ and we should clean pending requests a bit earlier. | 39 // dev_tools_agent_ and we should clean pending requests a bit earlier. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 web_tools_frontend_->dispatchOnInspectorFrontend(args.data_); | 75 web_tools_frontend_->dispatchOnInspectorFrontend(args.data_); |
76 if (TestShellDevToolsCallArgs::calls_count() == 1) | 76 if (TestShellDevToolsCallArgs::calls_count() == 1) |
77 all_messages_processed(); | 77 all_messages_processed(); |
78 } | 78 } |
79 | 79 |
80 void TestShellDevToolsClient::all_messages_processed() { | 80 void TestShellDevToolsClient::all_messages_processed() { |
81 web_view_->mainFrame()->executeScript(WebKit::WebScriptSource( | 81 web_view_->mainFrame()->executeScript(WebKit::WebScriptSource( |
82 WebString::fromUTF8("if (window.WebInspector && " | 82 WebString::fromUTF8("if (window.WebInspector && " |
83 "WebInspector.queuesAreEmpty) WebInspector.queuesAreEmpty();"))); | 83 "WebInspector.queuesAreEmpty) WebInspector.queuesAreEmpty();"))); |
84 } | 84 } |
OLD | NEW |