OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/mac/scoped_nsautorelease_pool.h" | |
14 #include "base/test/test_timeouts.h" | 13 #include "base/test/test_timeouts.h" |
15 #include "chrome/test/ui/ui_test.h" | 14 #include "chrome/test/ui/ui_test.h" |
16 #include "chrome/test/ui/ui_test_suite.h" | 15 #include "chrome/test/ui/ui_test_suite.h" |
17 | 16 |
| 17 #if defined(OS_MACOSX) |
| 18 #include "base/mac/scoped_nsautorelease_pool.h" |
| 19 #endif |
| 20 |
18 // The C++ style guide forbids using default arguments but I'm taking the | 21 // The C++ style guide forbids using default arguments but I'm taking the |
19 // liberty of allowing it in this file. The sole purpose of this (and the | 22 // liberty of allowing it in this file. The sole purpose of this (and the |
20 // .cc) is to support the python interface, and default args are allowed in | 23 // .cc) is to support the python interface, and default args are allowed in |
21 // python. Strictly adhering to the guide here would mean having to re-define | 24 // python. Strictly adhering to the guide here would mean having to re-define |
22 // all methods in python just for the sake of providing default args. This | 25 // all methods in python just for the sake of providing default args. This |
23 // seems cumbersome and unwanted. | 26 // seems cumbersome and unwanted. |
24 | 27 |
25 // Test Suite for Pyauto tests. All one-time initializations go here. | 28 // Test Suite for Pyauto tests. All one-time initializations go here. |
26 class PyUITestSuiteBase : public UITestSuite { | 29 class PyUITestSuiteBase : public UITestSuite { |
27 public: | 30 public: |
28 PyUITestSuiteBase(int argc, char** argv); | 31 PyUITestSuiteBase(int argc, char** argv); |
29 virtual ~PyUITestSuiteBase(); | 32 virtual ~PyUITestSuiteBase(); |
30 | 33 |
31 void InitializeWithPath(const FilePath& browser_dir); | 34 void InitializeWithPath(const FilePath& browser_dir); |
32 | 35 |
33 void SetCrSourceRoot(const FilePath& path); | 36 void SetCrSourceRoot(const FilePath& path); |
34 | 37 |
35 private: | 38 private: |
| 39 #if defined(OS_MACOSX) |
36 base::mac::ScopedNSAutoreleasePool pool_; | 40 base::mac::ScopedNSAutoreleasePool pool_; |
| 41 #endif |
37 }; | 42 }; |
38 | 43 |
39 // The primary class that interfaces with Automation Proxy. | 44 // The primary class that interfaces with Automation Proxy. |
40 // This class is accessed from python using swig. | 45 // This class is accessed from python using swig. |
41 class PyUITestBase : public UITestBase { | 46 class PyUITestBase : public UITestBase { |
42 public: | 47 public: |
43 // Only public methods are accessible from swig. | 48 // Only public methods are accessible from swig. |
44 | 49 |
45 // Constructor. Lookup pyauto.py for doc on these args. | 50 // Constructor. Lookup pyauto.py for doc on these args. |
46 PyUITestBase(bool clear_profile, std::wstring homepage); | 51 PyUITestBase(bool clear_profile, std::wstring homepage); |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 // This is necessary since python's unittest module creates instances of | 209 // This is necessary since python's unittest module creates instances of |
205 // TestCase at load time itself. | 210 // TestCase at load time itself. |
206 static MessageLoop* GetSharedMessageLoop(MessageLoop::Type msg_loop_type); | 211 static MessageLoop* GetSharedMessageLoop(MessageLoop::Type msg_loop_type); |
207 static MessageLoop* message_loop_; | 212 static MessageLoop* message_loop_; |
208 | 213 |
209 // Path to named channel id. | 214 // Path to named channel id. |
210 std::string named_channel_id_; | 215 std::string named_channel_id_; |
211 }; | 216 }; |
212 | 217 |
213 #endif // CHROME_TEST_PYAUTOLIB_PYAUTOLIB_H_ | 218 #endif // CHROME_TEST_PYAUTOLIB_PYAUTOLIB_H_ |
OLD | NEW |