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

Unified Diff: chrome/test/functional/tracing/timeline_model.js

Issue 10736055: Smoke test for tracing infrastructure in PyAuto (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Smoke test for tracing infrastructure in PyAuto Created 8 years, 5 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: chrome/test/functional/tracing/timeline_model.js
diff --git a/chrome/test/functional/tracing/timeline_model.js b/chrome/test/functional/tracing/timeline_model.js
new file mode 100644
index 0000000000000000000000000000000000000000..6c29075ea45e4c99b1026cad5eb8522f912f9061
--- /dev/null
+++ b/chrome/test/functional/tracing/timeline_model.js
@@ -0,0 +1,41 @@
+function invokeJsMethodFromPython(targetObject, methodName, args) {
+ var sendToPython = function(obj) {
nduca 2012/07/18 05:51:35 How about this being tracing_test_shim.js -- and f
nduca 2012/07/18 05:51:35 This is a private method, only to be called by the
+ // We use sendJSON here because domAutomationController's send() chokes
+ // on large amounts of data. Inside of send() it converts the arg to
+ // JSON and invokes sendJSON. The JSON conversion is what fails. This
nduca 2012/07/18 05:51:35 Why does the json conversion fail?
+ // way works around the bad code, but necessitates a double JSON
+ // conversion as the recieving python converts from JSON before passing
+ // it back to the pyauto test.
+ window.domAutomationController.sendJSON(
+ JSON.stringify(
nduca 2012/07/18 05:51:35 I'm so confused. This makes no sense. Also, does s
+ JSON.stringify(obj)
+ )
+ );
+ };
+ try {
nduca 2012/07/18 05:51:35 Why are you sourcing this file every time? You cou
+ sendToPython({
nduca 2012/07/18 05:51:35 Can't you break this up into individual lines inst
+ success: true,
+ data: targetObject[methodName].apply(targetObject, JSON.parse(args))
+ });
+ } catch( e ) {
+ var ret = {
+ success: false,
+ message: 'Unspecified error'
+ };
+ if( typeof(e) == 'string' || e instanceof String ) {
+ ret.message = e;
+ } else {
+ if( e.stack != undefined ) ret.stack = e.stack;
+ if( e.message != undefined ) ret.message = e.message;
+ }
+ // First we'll try sending with the exception embedded, and if that
+ // doesn't work, try sending without the exception.
nduca 2012/07/18 05:51:35 What? Why?
+ try {
+ sendToPython(ret);
+ } catch(e2) {
+ ret.exception = undefined;
+ sendToPython(ret);
+ }
+ throw e;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698