Chromium Code Reviews| Index: tools/chrome_remote_control/chrome_remote_control/replay_server.py |
| diff --git a/tools/chrome_remote_control/chrome_remote_control/replay_server.py b/tools/chrome_remote_control/chrome_remote_control/replay_server.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..bb349783d0864b436a6b51da8260dccc4b4c2e0e |
| --- /dev/null |
| +++ b/tools/chrome_remote_control/chrome_remote_control/replay_server.py |
| @@ -0,0 +1,45 @@ |
| +# Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| +import os |
| +import socket |
| +import subprocess |
| +import sys |
| +import urlparse |
| + |
| +# Get chrome/test/functional scripts into our path. |
|
nduca
2012/09/21 06:35:50
Can we ad a TODO to not have a dependency here if
tonyg
2012/09/25 17:29:29
Added TODO to sort this out.
|
| +sys.path.append( |
| + os.path.abspath( |
| + os.path.join(os.path.dirname(__file__), |
| + '../../../chrome/test/functional'))) |
| +import webpagereplay |
| + |
| +CHROME_FLAGS = webpagereplay.CHROME_FLAGS |
|
nduca
2012/09/21 06:35:50
Ah, I had forgotten is that in replay mode you nee
tonyg
2012/09/25 17:29:29
yeah, page_runner worked well with the addition of
|
| + |
| +class ReplayServer(object): |
| + def __init__(self, path, is_record_mode): |
| + # TODO(tonyg): Hook up the forwarder for android. Test on CrOS. |
| + replay_options = [] |
| + if is_record_mode: |
| + replay_options.append('--record') |
| + self._web_page_replay = webpagereplay.ReplayServer(path, replay_options) |
| + self._web_page_replay.StartServer() |
| + self._path = path |
| + |
| + def __enter__(self): |
| + return self |
| + |
| + def __exit__(self, *args): |
| + self.Close() |
| + |
| + def __del__(self): |
| + self.Close() |
| + |
| + def Close(self): |
| + if self._web_page_replay: |
| + self._web_page_replay.StopServer() |
| + self._web_page_replay = None |
| + |
| + @property |
| + def path(self): |
| + return self._path |