summaryrefslogtreecommitdiffstats
path: root/chrome/test/pyautolib/pyautolib.h
blob: 20e06798b742bc3bfb318d8d2a40095f4037746c (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
54
55
56
57
58
59
60
61
62
// Copyright (c) 2010 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.
//
// This file declares the C++ side of PyAuto, the python interface to
// Chromium automation.  It access Chromium's internals using Automation Proxy.

#ifndef CHROME_TEST_PYAUTOLIB_PYAUTOLIB_H_
#define CHROME_TEST_PYAUTOLIB_PYAUTOLIB_H_

#include "base/scoped_nsautorelease_pool.h"
#include "chrome/test/ui/ui_test.h"
#include "chrome/test/ui/ui_test_suite.h"

// TODO(nirnimesh): separate out the UITestSuite and UITestBase parts
//                  crbug.com/32292

// The primary class that interfaces with Automation Proxy.
// This class is accessed from python using swig.
class PyUITestSuite : public UITestSuite, public UITestBase {
 public:
  // Only public methods are accessible from swig.
  PyUITestSuite(int argc, char** argv);
  ~PyUITestSuite();

  // SetUp,TearDown is redeclared as public to make it accessible from swig.
  virtual void SetUp();
  virtual void TearDown();

  void NavigateToURL(const char* url_string);

  // Get the URL of the active tab.
  GURL GetActiveTabURL();

  // BrowserProxy methods

  // Shows or hides the download shelf.
  void SetShelfVisible(bool is_visible);

  // Determines the visibility of the download shelf
  bool IsShelfVisible();

  // Open the Find box
  void OpenFindInPage();

  // Determines the visibility of the Find box
  bool IsFindInPageVisible();

  // Get the path to the downloads directory
  std::string GetDownloadDirectory();

  // AutomationProxy methods

  // Open a new browser window. Returns false on failure.
  bool OpenNewBrowserWindow(bool show);

 private:
  base::ScopedNSAutoreleasePool pool_;
};

#endif  // CHROME_TEST_PYAUTOLIB_PYAUTOLIB_H_