Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: webkit/tools/test_shell/test_shell_devtools_client.cc

Issue 15028002: Delete test_shell. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add dummy test_shell build target. Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h"
6 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDevToolsAgent.h"
7 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDevToolsFrontend.h "
8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h"
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
11
12 #undef LOG
13 #include "webkit/tools/test_shell/test_shell_devtools_agent.h"
14 #include "webkit/tools/test_shell/test_shell_devtools_callargs.h"
15 #include "webkit/tools/test_shell/test_shell_devtools_client.h"
16
17 #include "base/bind.h"
18 #include "base/command_line.h"
19 #include "base/message_loop.h"
20
21 using WebKit::WebDevToolsAgent;
22 using WebKit::WebDevToolsFrontend;
23 using WebKit::WebDevToolsMessageData;
24 using WebKit::WebString;
25 using WebKit::WebView;
26
27 TestShellDevToolsClient::TestShellDevToolsClient(TestShellDevToolsAgent *agent,
28 WebView* web_view)
29 : weak_factory_(this),
30 dev_tools_agent_(agent),
31 web_view_(web_view) {
32 web_tools_frontend_.reset(WebDevToolsFrontend::create(web_view_, this,
33 WebString::fromUTF8("en-US")));
34 dev_tools_agent_->attach(this);
35 }
36
37 TestShellDevToolsClient::~TestShellDevToolsClient() {
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.
40 weak_factory_.InvalidateWeakPtrs();
41 if (dev_tools_agent_)
42 dev_tools_agent_->detach();
43 }
44
45 void TestShellDevToolsClient::sendMessageToBackend(
46 const WebString& data) {
47 if (dev_tools_agent_)
48 dev_tools_agent_->AsyncCall(TestShellDevToolsCallArgs(data));
49 }
50
51 void TestShellDevToolsClient::activateWindow() {
52 NOTIMPLEMENTED();
53 }
54
55 void TestShellDevToolsClient::closeWindow() {
56 NOTIMPLEMENTED();
57 }
58
59 void TestShellDevToolsClient::dockWindow() {
60 NOTIMPLEMENTED();
61 }
62
63 void TestShellDevToolsClient::undockWindow() {
64 NOTIMPLEMENTED();
65 }
66
67 void TestShellDevToolsClient::AsyncCall(const TestShellDevToolsCallArgs &args) {
68 MessageLoop::current()->PostTask(
69 FROM_HERE,
70 base::Bind(&TestShellDevToolsClient::Call, weak_factory_.GetWeakPtr(),
71 args));
72 }
73
74 void TestShellDevToolsClient::Call(const TestShellDevToolsCallArgs &args) {
75 web_tools_frontend_->dispatchOnInspectorFrontend(args.data_);
76 if (TestShellDevToolsCallArgs::calls_count() == 1)
77 all_messages_processed();
78 }
79
80 void TestShellDevToolsClient::all_messages_processed() {
81 web_view_->mainFrame()->executeScript(WebKit::WebScriptSource(
82 WebString::fromUTF8("if (window.WebInspector && "
83 "WebInspector.queuesAreEmpty) WebInspector.queuesAreEmpty();")));
84 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698