| 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 #ifndef CHROME_TEST_UI_TEST_UTILS_H_ | 5 #ifndef CHROME_TEST_UI_TEST_UTILS_H_ |
| 6 #define CHROME_TEST_UI_TEST_UTILS_H_ | 6 #define CHROME_TEST_UI_TEST_UTILS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <queue> | 10 #include <queue> |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 // object, and is stopped when the destructor is called. Note that | 273 // object, and is stopped when the destructor is called. Note that |
| 274 // because of the underlying script that is used: | 274 // because of the underlying script that is used: |
| 275 // | 275 // |
| 276 // third_paty/WebKit/Tools/Scripts/new-run-webkit-websocketserver | 276 // third_paty/WebKit/Tools/Scripts/new-run-webkit-websocketserver |
| 277 // | 277 // |
| 278 // Only *_wsh.py handlers found under "http/tests/websocket/tests" from the | 278 // Only *_wsh.py handlers found under "http/tests/websocket/tests" from the |
| 279 // |root_directory| will be found and active while running the test | 279 // |root_directory| will be found and active while running the test |
| 280 // server. | 280 // server. |
| 281 class TestWebSocketServer { | 281 class TestWebSocketServer { |
| 282 public: | 282 public: |
| 283 // Creates and starts a python websocket server with |root_directory|. | 283 TestWebSocketServer(); |
| 284 explicit TestWebSocketServer(const FilePath& root_directory); | |
| 285 | 284 |
| 286 // Destroys and stops the server. | 285 // Stops the python websocket server if it was already started. |
| 287 ~TestWebSocketServer(); | 286 ~TestWebSocketServer(); |
| 288 | 287 |
| 288 // Starts the python websocket server using |root_directory|. Returns whether |
| 289 // the server was successfully started. |
| 290 bool Start(const FilePath& root_directory); |
| 291 |
| 289 private: | 292 private: |
| 290 // Sets up PYTHONPATH to run websocket_server.py. | 293 // Sets up PYTHONPATH to run websocket_server.py. |
| 291 void SetPythonPath(); | 294 void SetPythonPath(); |
| 292 | 295 |
| 293 // Creates a CommandLine for invoking the python interpreter. | 296 // Creates a CommandLine for invoking the python interpreter. |
| 294 CommandLine* CreatePythonCommandLine(); | 297 CommandLine* CreatePythonCommandLine(); |
| 295 | 298 |
| 296 // Creates a CommandLine for invoking the python websocker server. | 299 // Creates a CommandLine for invoking the python websocker server. |
| 297 CommandLine* CreateWebSocketServerCommandLine(); | 300 CommandLine* CreateWebSocketServerCommandLine(); |
| 298 | 301 |
| 302 // Has the server been started? |
| 303 bool started_; |
| 304 |
| 299 // A Scoped temporary directory for holding the python pid file. | 305 // A Scoped temporary directory for holding the python pid file. |
| 300 ScopedTempDir temp_dir_; | 306 ScopedTempDir temp_dir_; |
| 301 | 307 |
| 302 // Used to close the same python interpreter when server falls out | 308 // Used to close the same python interpreter when server falls out |
| 303 // scope. | 309 // scope. |
| 304 FilePath websocket_pid_file_; | 310 FilePath websocket_pid_file_; |
| 305 | 311 |
| 306 DISALLOW_COPY_AND_ASSIGN(TestWebSocketServer); | 312 DISALLOW_COPY_AND_ASSIGN(TestWebSocketServer); |
| 307 }; | 313 }; |
| 308 | 314 |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 | 513 |
| 508 // Takes a snapshot of the entire page, according to the width and height | 514 // Takes a snapshot of the entire page, according to the width and height |
| 509 // properties of the DOM's document. Returns true on success. DOMAutomation | 515 // properties of the DOM's document. Returns true on success. DOMAutomation |
| 510 // must be enabled. | 516 // must be enabled. |
| 511 bool TakeEntirePageSnapshot(RenderViewHost* rvh, | 517 bool TakeEntirePageSnapshot(RenderViewHost* rvh, |
| 512 SkBitmap* bitmap) WARN_UNUSED_RESULT; | 518 SkBitmap* bitmap) WARN_UNUSED_RESULT; |
| 513 | 519 |
| 514 } // namespace ui_test_utils | 520 } // namespace ui_test_utils |
| 515 | 521 |
| 516 #endif // CHROME_TEST_UI_TEST_UTILS_H_ | 522 #endif // CHROME_TEST_UI_TEST_UTILS_H_ |
| OLD | NEW |