1 // Copyright 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.
5 #ifndef CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_TESTING_H_
6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_TESTING_H_
8 #include "base/callback.h"
9 #include "chrome/browser/devtools/devtools_window.h"
10 #include "ui/gfx/geometry/rect.h"
16 class DevToolsAgentHost
;
20 class DevToolsWindowTesting
{
22 virtual ~DevToolsWindowTesting();
24 // The following methods block until DevToolsWindow is completely loaded.
25 static DevToolsWindow
* OpenDevToolsWindowSync(
26 content::WebContents
* inspected_web_contents
,
28 static DevToolsWindow
* OpenDevToolsWindowSync(
29 Browser
* browser
, bool is_docked
);
30 static DevToolsWindow
* OpenDevToolsWindowForWorkerSync(
31 Profile
* profile
, content::DevToolsAgentHost
* worker_agent
);
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
);
38 static DevToolsWindowTesting
* Get(DevToolsWindow
* window
);
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
);
47 friend class DevToolsWindow
;
49 explicit DevToolsWindowTesting(DevToolsWindow
* window
);
50 static void WaitForDevToolsWindowLoad(DevToolsWindow
* window
);
51 static void WindowClosed(DevToolsWindow
* window
);
52 static DevToolsWindowTesting
* Find(DevToolsWindow
* window
);
54 DevToolsWindow
* devtools_window_
;
55 base::Closure close_callback_
;
57 DISALLOW_COPY_AND_ASSIGN(DevToolsWindowTesting
);
60 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_TESTING_H_