Index: native_client_sdk/src/tests/sdk_util_test/example.js |
diff --git a/native_client_sdk/src/tests/sdk_util_test/example.js b/native_client_sdk/src/tests/sdk_util_test/example.js |
index d004ac4510930ae39b240b7bcef1dbe77c266e2d..8b95dbf6a1e345831204e5b16efda2923c103603 100644 |
--- a/native_client_sdk/src/tests/sdk_util_test/example.js |
+++ b/native_client_sdk/src/tests/sdk_util_test/example.js |
@@ -1,4 +1,4 @@ |
-// Copyright 2013 The Chromium Authors. All rights reserved. |
+// 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. |
// Called by the common.js module. |
@@ -9,6 +9,8 @@ function moduleDidLoad() { |
} |
var currentTestEl = null; |
+var failedTests = 0; |
+var testsFinished = false; |
function startCommand(testName) { |
var testListEl = document.getElementById('tests'); |
@@ -32,6 +34,7 @@ function failCommand(fileName, lineNumber, summary) { |
var testMessageEl = document.createElement('pre'); |
testMessageEl.textContent += fileName + ':' + lineNumber + ': ' + summary; |
currentTestEl.appendChild(testMessageEl); |
+ failedTests++; |
} |
function endCommand(testName, testResult) { |
@@ -41,10 +44,22 @@ function endCommand(testName, testResult) { |
testResultEl.textContent = testResult; |
} |
+function testendCommand() { |
+ testsFinished = true; |
+ |
+ if (failedTests) { |
+ common.updateStatus('FAILED'); |
+ document.getElementById('statusField').classList.add('failed'); |
+ } else { |
+ common.updateStatus('OK'); |
+ document.getElementById('statusField').classList.add('ok'); |
+ } |
+} |
+ |
function handleMessage(event) { |
var msg = event.data; |
var firstColon = msg.indexOf(':'); |
- var cmd = msg.substr(0, firstColon); |
+ var cmd = firstColon !== -1 ? msg.substr(0, firstColon) : msg; |
var cmdFunctionName = cmd + 'Command'; |
var cmdFunction = window[cmdFunctionName]; |