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

Unified Diff: ppapi/native_client/tests/nacl_browser/browser_startup_time/browser_startup_time.js

Issue 10914053: Relocating files in the nacl repo that belong in chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge 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: ppapi/native_client/tests/nacl_browser/browser_startup_time/browser_startup_time.js
diff --git a/ppapi/native_client/tests/nacl_browser/browser_startup_time/browser_startup_time.js b/ppapi/native_client/tests/nacl_browser/browser_startup_time/browser_startup_time.js
new file mode 100644
index 0000000000000000000000000000000000000000..4aee3c43289580d523ba2fc225ee6945dc4d5c3b
--- /dev/null
+++ b/ppapi/native_client/tests/nacl_browser/browser_startup_time/browser_startup_time.js
@@ -0,0 +1,46 @@
+// Copyright (c) 2011 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.
+
+// Times how long the nexe took to load, then smoke tests it.
+
+function LoadingTester(plugin) {
+ // Workaround how JS binds 'this'
+ var this_ = this;
+
+ this.rpc_ = new RPCWrapper();
+
+ this.setupLoad = function() {
+ var loadBegin = (new Date).getTime();
+ this_.rpc_.startup();
+ var waiter = new NaClWaiter();
+
+ waiter.waitFor(plugin);
+ waiter.run(
+ function(loaded, waiting) {
+ var loadEnd = (new Date).getTime();
+ logLoadStatus(this_.rpc_, true, loaded, waiting);
+ // Log the total in-browser load time (for first load).
+ this_.rpc_.logTimeData('Total',
+ (loadEnd - loadBegin));
+ this_.doSmokeTests_(plugin);
+ },
+ function() {
+ this_.rpc_.ping();
+ }
+ );
+ }
+
+ this.doSmokeTests_ = function(plugin) {
+ var tester = new Tester();
+ tester.addAsyncTest('TestHello', function(status) {
+ plugin.addEventListener('message', function(message_event) {
+ this.removeEventListener('message', arguments.callee, false);
+ status.assertEqual(message_event.data, 'hello from NaCl');
+ status.pass();
+ }, false);
+ plugin.postMessage('hello');
+ });
+ tester.run();
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698