| 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" | |
| 16 #include "chrome/test/ui/ui_test.h" | 15 #include "chrome/test/ui/ui_test.h" |
| 17 #include "chrome/test/ui/ui_test_suite.h" | 16 #include "chrome/test/ui/ui_test_suite.h" |
| 18 | 17 |
| 19 #if defined(OS_MACOSX) | 18 #if defined(OS_MACOSX) |
| 20 #include "base/mac/scoped_nsautorelease_pool.h" | 19 #include "base/mac/scoped_nsautorelease_pool.h" |
| 21 #endif | 20 #endif |
| 22 | 21 |
| 23 class AutomationProxy; | 22 class AutomationProxy; |
| 24 | 23 |
| 25 // The C++ style guide forbids using default arguments but I'm taking the | 24 // 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... |
| 205 return TestTimeouts::large_test_timeout_ms(); | 204 return TestTimeouts::large_test_timeout_ms(); |
| 206 } | 205 } |
| 207 | 206 |
| 208 protected: | 207 protected: |
| 209 // Gets the automation proxy and checks that it exists. | 208 // Gets the automation proxy and checks that it exists. |
| 210 virtual AutomationProxy* automation() const OVERRIDE; | 209 virtual AutomationProxy* automation() const OVERRIDE; |
| 211 | 210 |
| 212 virtual void SetLaunchSwitches() OVERRIDE; | 211 virtual void SetLaunchSwitches() OVERRIDE; |
| 213 | 212 |
| 214 private: | 213 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 | |
| 225 // Gets the current state of the bookmark bar. Returns false if it failed. | 214 // Gets the current state of the bookmark bar. Returns false if it failed. |
| 226 bool GetBookmarkBarState(bool* visible, bool* detached, int window_index = 0); | 215 bool GetBookmarkBarState(bool* visible, bool* detached, int window_index = 0); |
| 227 | 216 |
| 228 // Enables PostTask to main thread. | 217 // Enables PostTask to main thread. |
| 229 // Should be shared across multiple instances of PyUITestBase so that this | 218 // Should be shared across multiple instances of PyUITestBase so that this |
| 230 // class is re-entrant and multiple instances can be created. | 219 // class is re-entrant and multiple instances can be created. |
| 231 // This is necessary since python's unittest module creates instances of | 220 // This is necessary since python's unittest module creates instances of |
| 232 // TestCase at load time itself. | 221 // TestCase at load time itself. |
| 233 static MessageLoop* GetSharedMessageLoop(MessageLoop::Type msg_loop_type); | 222 static MessageLoop* GetSharedMessageLoop(MessageLoop::Type msg_loop_type); |
| 234 static MessageLoop* message_loop_; | 223 static MessageLoop* message_loop_; |
| 235 | 224 |
| 236 // Path to named channel id. | 225 // Path to named channel id. |
| 237 std::string named_channel_id_; | 226 std::string named_channel_id_; |
| 238 }; | 227 }; |
| 239 | 228 |
| 240 #endif // CHROME_TEST_PYAUTOLIB_PYAUTOLIB_H_ | 229 #endif // CHROME_TEST_PYAUTOLIB_PYAUTOLIB_H_ |
| OLD | NEW |