summaryrefslogtreecommitdiffstats
path: root/content/shell/browser/layout_test/layout_test_devtools_frontend.h
blob: 839a9a56938c349713a5ae5bf8adbfdf85b71291 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_DEVTOOLS_FRONTEND_H_
#define CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_DEVTOOLS_FRONTEND_H_

#include "base/compiler_specific.h"
#include "base/macros.h"
#include "content/shell/browser/shell_devtools_frontend.h"

namespace content {

class RenderViewHost;
class Shell;
class WebContents;

class LayoutTestDevToolsFrontend : public ShellDevToolsFrontend {
 public:
  static LayoutTestDevToolsFrontend* Show(WebContents* inspected_contents,
                                          const std::string& settings,
                                          const std::string& frontend_url);

  static GURL GetDevToolsPathAsURL(const std::string& settings,
                                   const std::string& frontend_url);

  void ReuseFrontend(const std::string& settings,
                     const std::string frontend_url);
  void EvaluateInFrontend(int call_id, const std::string& expression);

 private:
  LayoutTestDevToolsFrontend(Shell* frontend_shell,
                             WebContents* inspected_contents);
  ~LayoutTestDevToolsFrontend() override;

  // content::DevToolsAgentHostClient implementation.
  void AgentHostClosed(DevToolsAgentHost* agent_host, bool replaced) override;

  // ShellDevToolsFrontend overrides.
  void HandleMessageFromDevToolsFrontend(const std::string& message) override;

  // WebContentsObserver implementation.
  void RenderProcessGone(base::TerminationStatus status) override;

  bool ready_for_test_;
  std::vector<std::pair<int, std::string>> pending_evaluations_;

  DISALLOW_COPY_AND_ASSIGN(LayoutTestDevToolsFrontend);
};

}  // namespace content

#endif  // CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_DEVTOOLS_FRONTEND_H_