| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 // | 4 // |
| 5 // This file declares the C++ side of PyAuto, the python interface to | 5 // This file declares the C++ side of PyAuto, the python interface to |
| 6 // Chromium automation. It access Chromium's internals using Automation Proxy. | 6 // Chromium automation. It access Chromium's internals using Automation Proxy. |
| 7 | 7 |
| 8 #ifndef CHROME_TEST_PYAUTOLIB_PYAUTOLIB_H_ | 8 #ifndef CHROME_TEST_PYAUTOLIB_PYAUTOLIB_H_ |
| 9 #define CHROME_TEST_PYAUTOLIB_PYAUTOLIB_H_ | 9 #define CHROME_TEST_PYAUTOLIB_PYAUTOLIB_H_ |
| 10 #pragma once | 10 #pragma once |
| 11 | 11 |
| 12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
| 13 #include "base/scoped_nsautorelease_pool.h" | 13 #include "base/mac/scoped_nsautorelease_pool.h" |
| 14 #include "chrome/test/ui/ui_test.h" | 14 #include "chrome/test/ui/ui_test.h" |
| 15 #include "chrome/test/ui/ui_test_suite.h" | 15 #include "chrome/test/ui/ui_test_suite.h" |
| 16 | 16 |
| 17 // The C++ style guide forbids using default arguments but I'm taking the | 17 // The C++ style guide forbids using default arguments but I'm taking the |
| 18 // liberty of allowing it in this file. The sole purpose of this (and the | 18 // liberty of allowing it in this file. The sole purpose of this (and the |
| 19 // .cc) is to support the python interface, and default args are allowed in | 19 // .cc) is to support the python interface, and default args are allowed in |
| 20 // python. Strictly adhering to the guide here would mean having to re-define | 20 // python. Strictly adhering to the guide here would mean having to re-define |
| 21 // all methods in python just for the sake of providing default args. This | 21 // all methods in python just for the sake of providing default args. This |
| 22 // seems cumbersome and unwanted. | 22 // seems cumbersome and unwanted. |
| 23 | 23 |
| 24 // Test Suite for Pyauto tests. All one-time initializations go here. | 24 // Test Suite for Pyauto tests. All one-time initializations go here. |
| 25 class PyUITestSuiteBase : public UITestSuite { | 25 class PyUITestSuiteBase : public UITestSuite { |
| 26 public: | 26 public: |
| 27 PyUITestSuiteBase(int argc, char** argv); | 27 PyUITestSuiteBase(int argc, char** argv); |
| 28 ~PyUITestSuiteBase(); | 28 ~PyUITestSuiteBase(); |
| 29 | 29 |
| 30 void Initialize(const FilePath& browser_dir); | 30 void Initialize(const FilePath& browser_dir); |
| 31 | 31 |
| 32 private: | 32 private: |
| 33 base::ScopedNSAutoreleasePool pool_; | 33 base::mac::ScopedNSAutoreleasePool pool_; |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 // The primary class that interfaces with Automation Proxy. | 36 // The primary class that interfaces with Automation Proxy. |
| 37 // This class is accessed from python using swig. | 37 // This class is accessed from python using swig. |
| 38 class PyUITestBase : public UITestBase { | 38 class PyUITestBase : public UITestBase { |
| 39 public: | 39 public: |
| 40 // Only public methods are accessible from swig. | 40 // Only public methods are accessible from swig. |
| 41 | 41 |
| 42 // Constructor. Lookup pyauto.py for doc on these args. | 42 // Constructor. Lookup pyauto.py for doc on these args. |
| 43 PyUITestBase(bool clear_profile, std::wstring homepage); | 43 PyUITestBase(bool clear_profile, std::wstring homepage); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 // Enables PostTask to main thread. | 181 // Enables PostTask to main thread. |
| 182 // Should be shared across multiple instances of PyUITestBase so that this | 182 // Should be shared across multiple instances of PyUITestBase so that this |
| 183 // class is re-entrant and multiple instances can be created. | 183 // class is re-entrant and multiple instances can be created. |
| 184 // This is necessary since python's unittest module creates instances of | 184 // This is necessary since python's unittest module creates instances of |
| 185 // TestCase at load time itself. | 185 // TestCase at load time itself. |
| 186 static MessageLoop* GetSharedMessageLoop(MessageLoop::Type msg_loop_type); | 186 static MessageLoop* GetSharedMessageLoop(MessageLoop::Type msg_loop_type); |
| 187 static MessageLoop* message_loop_; | 187 static MessageLoop* message_loop_; |
| 188 }; | 188 }; |
| 189 | 189 |
| 190 #endif // CHROME_TEST_PYAUTOLIB_PYAUTOLIB_H_ | 190 #endif // CHROME_TEST_PYAUTOLIB_PYAUTOLIB_H_ |
| OLD | NEW |