OLD | NEW |
| (Empty) |
1 // Copyright (c) 2014 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 #ifndef CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_TESTING_H_ | |
6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_TESTING_H_ | |
7 | |
8 #include "base/callback.h" | |
9 #include "chrome/browser/devtools/devtools_window.h" | |
10 #include "ui/gfx/rect.h" | |
11 | |
12 class Browser; | |
13 class Profile; | |
14 | |
15 namespace content { | |
16 class DevToolsAgentHost; | |
17 class RenderViewHost; | |
18 class WebContents; | |
19 } | |
20 | |
21 class DevToolsWindowTesting { | |
22 public: | |
23 virtual ~DevToolsWindowTesting(); | |
24 | |
25 // The following methods block until DevToolsWindow is completely loaded. | |
26 static DevToolsWindow* OpenDevToolsWindowSync( | |
27 content::RenderViewHost* inspected_rvh, bool is_docked); | |
28 static DevToolsWindow* OpenDevToolsWindowSync( | |
29 Browser* browser, bool is_docked); | |
30 static DevToolsWindow* OpenDevToolsWindowForWorkerSync( | |
31 Profile* profile, content::DevToolsAgentHost* worker_agent); | |
32 | |
33 // Closes the window like it was user-initiated. | |
34 static void CloseDevToolsWindow(DevToolsWindow* window); | |
35 // Blocks until window is closed. | |
36 static void CloseDevToolsWindowSync(DevToolsWindow* window); | |
37 | |
38 static DevToolsWindowTesting* Get(DevToolsWindow* window); | |
39 | |
40 Browser* browser(); | |
41 content::WebContents* main_web_contents(); | |
42 content::WebContents* toolbox_web_contents(); | |
43 void SetInspectedPageBounds(const gfx::Rect& bounds); | |
44 void SetCloseCallback(const base::Closure& closure); | |
45 | |
46 private: | |
47 friend class DevToolsWindow; | |
48 | |
49 explicit DevToolsWindowTesting(DevToolsWindow* window); | |
50 static void WaitForDevToolsWindowLoad(DevToolsWindow* window); | |
51 static void WindowClosed(DevToolsWindow* window); | |
52 static DevToolsWindowTesting* Find(DevToolsWindow* window); | |
53 | |
54 DevToolsWindow* devtools_window_; | |
55 base::Closure close_callback_; | |
56 | |
57 DISALLOW_COPY_AND_ASSIGN(DevToolsWindowTesting); | |
58 }; | |
59 | |
60 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_TESTING_H_ | |
OLD | NEW |