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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 // object, and is stopped when the destructor is called. Note that | 314 // object, and is stopped when the destructor is called. Note that |
315 // because of the underlying script that is used: | 315 // because of the underlying script that is used: |
316 // | 316 // |
317 // third_paty/WebKit/Tools/Scripts/new-run-webkit-websocketserver | 317 // third_paty/WebKit/Tools/Scripts/new-run-webkit-websocketserver |
318 // | 318 // |
319 // Only *_wsh.py handlers found under "http/tests/websocket/tests" from the | 319 // Only *_wsh.py handlers found under "http/tests/websocket/tests" from the |
320 // |root_directory| will be found and active while running the test | 320 // |root_directory| will be found and active while running the test |
321 // server. | 321 // server. |
322 class TestWebSocketServer { | 322 class TestWebSocketServer { |
323 public: | 323 public: |
324 // Creates and starts a python websocket server with |root_directory|. | 324 TestWebSocketServer(); |
325 explicit TestWebSocketServer(const FilePath& root_directory); | |
326 | 325 |
327 // Destroys and stops the server. | 326 // Stops the python websocket server if it was already started. |
328 ~TestWebSocketServer(); | 327 ~TestWebSocketServer(); |
329 | 328 |
| 329 // Starts the python websocket server using |root_directory|. Returns whether |
| 330 // the server was successfully started. |
| 331 bool Start(const FilePath& root_directory); |
| 332 |
330 private: | 333 private: |
331 // Sets up PYTHONPATH to run websocket_server.py. | 334 // Sets up PYTHONPATH to run websocket_server.py. |
332 void SetPythonPath(); | 335 void SetPythonPath(); |
333 | 336 |
334 // Creates a CommandLine for invoking the python interpreter. | 337 // Creates a CommandLine for invoking the python interpreter. |
335 CommandLine* CreatePythonCommandLine(); | 338 CommandLine* CreatePythonCommandLine(); |
336 | 339 |
337 // Creates a CommandLine for invoking the python websocker server. | 340 // Creates a CommandLine for invoking the python websocker server. |
338 CommandLine* CreateWebSocketServerCommandLine(); | 341 CommandLine* CreateWebSocketServerCommandLine(); |
339 | 342 |
| 343 // Has the server been started? |
| 344 bool started_; |
| 345 |
340 // A Scoped temporary directory for holding the python pid file. | 346 // A Scoped temporary directory for holding the python pid file. |
341 ScopedTempDir temp_dir_; | 347 ScopedTempDir temp_dir_; |
342 | 348 |
343 // Used to close the same python interpreter when server falls out | 349 // Used to close the same python interpreter when server falls out |
344 // scope. | 350 // scope. |
345 FilePath websocket_pid_file_; | 351 FilePath websocket_pid_file_; |
346 | 352 |
347 DISALLOW_COPY_AND_ASSIGN(TestWebSocketServer); | 353 DISALLOW_COPY_AND_ASSIGN(TestWebSocketServer); |
348 }; | 354 }; |
349 | 355 |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 | 554 |
549 // Takes a snapshot of the entire page, according to the width and height | 555 // Takes a snapshot of the entire page, according to the width and height |
550 // properties of the DOM's document. Returns true on success. DOMAutomation | 556 // properties of the DOM's document. Returns true on success. DOMAutomation |
551 // must be enabled. | 557 // must be enabled. |
552 bool TakeEntirePageSnapshot(RenderViewHost* rvh, | 558 bool TakeEntirePageSnapshot(RenderViewHost* rvh, |
553 SkBitmap* bitmap) WARN_UNUSED_RESULT; | 559 SkBitmap* bitmap) WARN_UNUSED_RESULT; |
554 | 560 |
555 } // namespace ui_test_utils | 561 } // namespace ui_test_utils |
556 | 562 |
557 #endif // CHROME_TEST_UI_TEST_UTILS_H_ | 563 #endif // CHROME_TEST_UI_TEST_UTILS_H_ |
OLD | NEW |