Roll src/third_party/WebKit bf18a82:a9cee16 (svn 185297:185304)
[chromium-blink-merge.git] / chrome / test / chromedriver / chrome / automation_extension.h
blobc431e5a488251bb52ef023d53ead48bb7534a5b2
1 // Copyright (c) 2013 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_TEST_CHROMEDRIVER_CHROME_AUTOMATION_EXTENSION_H_
6 #define CHROME_TEST_CHROMEDRIVER_CHROME_AUTOMATION_EXTENSION_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h"
13 namespace base {
14 class DictionaryValue;
17 class Status;
18 class WebView;
20 // Automates Chrome through the extension APIs.
21 class AutomationExtension {
22 public:
23 explicit AutomationExtension(scoped_ptr<WebView> web_view);
24 ~AutomationExtension();
26 // Captures the visible part of the current tab as a base64-encoded PNG.
27 // Returns |kForbidden| for security restricted pages.
28 Status CaptureScreenshot(std::string* screenshot);
30 // Launches an app with the specified id.
31 Status LaunchApp(std::string id);
33 // Gets the position of the current window.
34 Status GetWindowPosition(int* x, int* y);
36 // Sets the position of the current window.
37 Status SetWindowPosition(int x, int y);
39 // Gets the size of the current window.
40 Status GetWindowSize(int* width, int* height);
42 // Sets the size of the current window.
43 Status SetWindowSize(int width, int height);
45 // Maximizes the current window.
46 Status MaximizeWindow();
48 private:
49 Status GetWindowInfo(int* x, int* y, int* width, int* height);
50 Status UpdateWindow(const base::DictionaryValue& update_info);
52 scoped_ptr<WebView> web_view_;
54 DISALLOW_COPY_AND_ASSIGN(AutomationExtension);
57 #endif // CHROME_TEST_CHROMEDRIVER_CHROME_AUTOMATION_EXTENSION_H_