| 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 return TestTimeouts::large_test_timeout_ms(); | 205 return TestTimeouts::large_test_timeout_ms(); |
| 205 } | 206 } |
| 206 | 207 |
| 207 protected: | 208 protected: |
| 208 // Gets the automation proxy and checks that it exists. | 209 // Gets the automation proxy and checks that it exists. |
| 209 virtual AutomationProxy* automation() const OVERRIDE; | 210 virtual AutomationProxy* automation() const OVERRIDE; |
| 210 | 211 |
| 211 virtual void SetLaunchSwitches() OVERRIDE; | 212 virtual void SetLaunchSwitches() OVERRIDE; |
| 212 | 213 |
| 213 private: | 214 private: |
| 215 // Create JSON error responses. |
| 216 void ErrorResponse(const std::string& error_string, |
| 217 const std::string& request, |
| 218 std::string* response); |
| 219 void RequestFailureResponse( |
| 220 const std::string& request, |
| 221 const base::TimeDelta& duration, |
| 222 const base::TimeDelta& timeout, |
| 223 std::string* response); |
| 224 |
| 214 // Gets the current state of the bookmark bar. Returns false if it failed. | 225 // Gets the current state of the bookmark bar. Returns false if it failed. |
| 215 bool GetBookmarkBarState(bool* visible, bool* detached, int window_index = 0); | 226 bool GetBookmarkBarState(bool* visible, bool* detached, int window_index = 0); |
| 216 | 227 |
| 217 // Enables PostTask to main thread. | 228 // Enables PostTask to main thread. |
| 218 // Should be shared across multiple instances of PyUITestBase so that this | 229 // Should be shared across multiple instances of PyUITestBase so that this |
| 219 // class is re-entrant and multiple instances can be created. | 230 // class is re-entrant and multiple instances can be created. |
| 220 // This is necessary since python's unittest module creates instances of | 231 // This is necessary since python's unittest module creates instances of |
| 221 // TestCase at load time itself. | 232 // TestCase at load time itself. |
| 222 static MessageLoop* GetSharedMessageLoop(MessageLoop::Type msg_loop_type); | 233 static MessageLoop* GetSharedMessageLoop(MessageLoop::Type msg_loop_type); |
| 223 static MessageLoop* message_loop_; | 234 static MessageLoop* message_loop_; |
| 224 | 235 |
| 225 // Path to named channel id. | 236 // Path to named channel id. |
| 226 std::string named_channel_id_; | 237 std::string named_channel_id_; |
| 227 }; | 238 }; |
| 228 | 239 |
| 229 #endif // CHROME_TEST_PYAUTOLIB_PYAUTOLIB_H_ | 240 #endif // CHROME_TEST_PYAUTOLIB_PYAUTOLIB_H_ |
| OLD | NEW |