| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
| 14 #include "base/test/test_timeouts.h" | 14 #include "base/test/test_timeouts.h" |
| 15 #include "base/time.h" |
| 15 #include "chrome/test/ui/ui_test.h" | 16 #include "chrome/test/ui/ui_test.h" |
| 16 #include "chrome/test/ui/ui_test_suite.h" | 17 #include "chrome/test/ui/ui_test_suite.h" |
| 17 | 18 |
| 18 #if defined(OS_MACOSX) | 19 #if defined(OS_MACOSX) |
| 19 #include "base/mac/scoped_nsautorelease_pool.h" | 20 #include "base/mac/scoped_nsautorelease_pool.h" |
| 20 #endif | 21 #endif |
| 21 | 22 |
| 22 class AutomationProxy; | 23 class AutomationProxy; |
| 23 | 24 |
| 24 // The C++ style guide forbids using default arguments but I'm taking the | 25 // The C++ style guide forbids using default arguments but I'm taking the |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 return TestTimeouts::large_test_timeout_ms(); | 201 return TestTimeouts::large_test_timeout_ms(); |
| 201 } | 202 } |
| 202 | 203 |
| 203 protected: | 204 protected: |
| 204 // Gets the automation proxy and checks that it exists. | 205 // Gets the automation proxy and checks that it exists. |
| 205 virtual AutomationProxy* automation() const OVERRIDE; | 206 virtual AutomationProxy* automation() const OVERRIDE; |
| 206 | 207 |
| 207 virtual void SetLaunchSwitches() OVERRIDE; | 208 virtual void SetLaunchSwitches() OVERRIDE; |
| 208 | 209 |
| 209 private: | 210 private: |
| 211 // Create JSON error responses. |
| 212 void ErrorResponse(const std::string& error_string, |
| 213 const std::string& request, |
| 214 std::string* response); |
| 215 void RequestFailureResponse( |
| 216 const std::string& request, |
| 217 const base::TimeDelta& duration, |
| 218 const base::TimeDelta& timeout, |
| 219 std::string* response); |
| 220 |
| 210 // Gets the current state of the bookmark bar. Returns false if it failed. | 221 // Gets the current state of the bookmark bar. Returns false if it failed. |
| 211 bool GetBookmarkBarState(bool* visible, bool* detached); | 222 bool GetBookmarkBarState(bool* visible, bool* detached); |
| 212 | 223 |
| 213 // Enables PostTask to main thread. | 224 // Enables PostTask to main thread. |
| 214 // Should be shared across multiple instances of PyUITestBase so that this | 225 // Should be shared across multiple instances of PyUITestBase so that this |
| 215 // class is re-entrant and multiple instances can be created. | 226 // class is re-entrant and multiple instances can be created. |
| 216 // This is necessary since python's unittest module creates instances of | 227 // This is necessary since python's unittest module creates instances of |
| 217 // TestCase at load time itself. | 228 // TestCase at load time itself. |
| 218 static MessageLoop* GetSharedMessageLoop(MessageLoop::Type msg_loop_type); | 229 static MessageLoop* GetSharedMessageLoop(MessageLoop::Type msg_loop_type); |
| 219 static MessageLoop* message_loop_; | 230 static MessageLoop* message_loop_; |
| 220 | 231 |
| 221 // Path to named channel id. | 232 // Path to named channel id. |
| 222 std::string named_channel_id_; | 233 std::string named_channel_id_; |
| 223 }; | 234 }; |
| 224 | 235 |
| 225 #endif // CHROME_TEST_PYAUTOLIB_PYAUTOLIB_H_ | 236 #endif // CHROME_TEST_PYAUTOLIB_PYAUTOLIB_H_ |
| OLD | NEW |