Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: tools/chrome_remote_control/chrome_remote_control/replay_server.py

Issue 10965027: Add web page replay to chrome_remote_control. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698