Skip to Content.
Sympa Menu

ndt-dev - [ndt-dev] [ndt] r954 committed - Merged latest trunk changes into FlashIssue117 branch

Subject: NDT-DEV email list created

List archive

[ndt-dev] [ndt] r954 committed - Merged latest trunk changes into FlashIssue117 branch


Chronological Thread 
  • From:
  • To:
  • Subject: [ndt-dev] [ndt] r954 committed - Merged latest trunk changes into FlashIssue117 branch
  • Date: Fri, 21 Feb 2014 08:34:57 +0000

Revision: 954
Author:

Date: Fri Feb 21 08:34:29 2014 UTC
Log: Merged latest trunk changes into FlashIssue117 branch

http://code.google.com/p/ndt/source/detail?r=954

Modified:
/branches/FlashIssue117
/branches/FlashIssue117/flash-client/src/GUI.as
/branches/FlashIssue117/flash-client/src/Handshake.as
/branches/FlashIssue117/flash-client/src/Main.as
/branches/FlashIssue117/flash-client/src/NDTConstants.as
/branches/FlashIssue117/flash-client/src/NDTPController.as
/branches/FlashIssue117/flash-client/src/NDTUtils.as
/branches/FlashIssue117/flash-client/src/TestC2S.as
/branches/FlashIssue117/flash-client/src/TestMETA.as
/branches/FlashIssue117/flash-client/src/TestResults.as
/branches/FlashIssue117/flash-client/src/TestS2C.as

=======================================
--- /branches/FlashIssue117/flash-client/src/GUI.as Sun Feb 2 19:14:17 2014 UTC
+++ /branches/FlashIssue117/flash-client/src/GUI.as Fri Feb 21 08:34:29 2014 UTC
@@ -48,10 +48,12 @@
private var _consoleText:TextField;
private var _resultsTextField:TextField;
private var _summaryResultText:String;
- private var _resultsButton:Sprite;
- private var _detailsButton:Sprite;
- private var _errorsButton:Sprite;
- private var _debugButton:Sprite;
+ private var _resultsButton:NDTButton;
+ private var _detailsButton:NDTButton;
+ private var _errorsButton:NDTButton;
+ private var _debugButton:NDTButton;
+ private var _activeButton:NDTButton;
+ private var _restartButton:Sprite;

public function GUI(
stageWidth:int, stageHeight:int, callerObj:NDTPController) {
@@ -75,17 +77,7 @@
_aboutNDTText.height = 0.40 * _stageHeight;
_aboutNDTText.wordWrap = true;
_aboutNDTText.selectable = false;
- _aboutNDTText.text = "Network Diagnostic Tool (NDT) provides a "
- + "sophisticated speed and diagnostic test. An NDT "
- + "test reports more than just the upload and "
- + "download speeds -- it also attempts to determine "
- + "what, if any, problems limited these speeds, "
- + "differentiating between computer configuration "
- + "and network infrastructure problems. While the "
- + "diagnostic messages are most useful for expert "
- + "users, they can also help novice users by "
- + "allowing them to provide detailed trouble "
- + "reports to their network administrator.";
+ _aboutNDTText.text = Main.ndt_description;

// 3) Learn more link
_urlRequest = new URLRequest(NDTConstants.MLAB_SITE);
@@ -172,12 +164,38 @@
_startButton.removeEventListener(MouseEvent.ROLL_OUT, rollOut);
_startButton.removeEventListener(MouseEvent.CLICK, clickStart);
}
+
+ private function hideResultsScreen():void {
+ while (this.numChildren > 0)
+ this.removeChildAt(0);
+
+ _resultsButton.removeEventListener(MouseEvent.ROLL_OVER, rollOver);
+ _detailsButton.removeEventListener(MouseEvent.ROLL_OVER, rollOver);
+ _errorsButton.removeEventListener(MouseEvent.ROLL_OVER, rollOver);
+ if (_debugButton)
+ _debugButton.removeEventListener(MouseEvent.ROLL_OVER, rollOver);
+ _restartButton.removeEventListener(MouseEvent.ROLL_OVER, rollOver);
+
+ _resultsButton.removeEventListener(MouseEvent.ROLL_OUT, rollOut);
+ _detailsButton.removeEventListener(MouseEvent.ROLL_OUT, rollOut);
+ _errorsButton.removeEventListener(MouseEvent.ROLL_OUT, rollOut);
+ if (_debugButton)
+ _debugButton.removeEventListener(MouseEvent.ROLL_OUT, rollOut);
+ _restartButton.removeEventListener(MouseEvent.ROLL_OUT, rollOut);
+
+ _resultsButton.removeEventListener(MouseEvent.CLICK, clickResults);
+ _detailsButton.removeEventListener(MouseEvent.CLICK, clickDetails);
+ _errorsButton.removeEventListener(MouseEvent.CLICK, clickErrors);
+ if (_debugButton)
+ _debugButton.removeEventListener(MouseEvent.CLICK, clickDebug);
+ _restartButton.removeEventListener(MouseEvent.CLICK, clickRestart);
+ }

/**
* Add text to the console while the NDT test is running.
*/
public function addConsoleOutput(text:String):void {
- _consoleText.appendText(text);
+ _consoleText.htmlText += text;
_consoleText.scrollV++;
}

@@ -211,43 +229,52 @@
_errorsButton = new NDTButton("ERRORS", 18, 30, 0.25);
if (CONFIG::debug)
_debugButton = new NDTButton("DEBUG", 18, 30, 0.25);
+ _restartButton = new NDTButton("RESTART", 18, 30, 0.25);

- var verticalMargin:Number = _stageHeight / 4;
+ var verticalMargin:Number = _stageHeight / 5;
if (CONFIG::debug)
- verticalMargin = _stageHeight / 5;
+ verticalMargin = _stageHeight / 6;
_resultsButton.y = verticalMargin;
_detailsButton.y = _resultsButton.y + verticalMargin;
_errorsButton.y = _detailsButton.y + verticalMargin;
_debugButton.y = _errorsButton.y + verticalMargin;
+ _restartButton.y = CONFIG::debug ? _debugButton.y + verticalMargin
+ : _errorsButton.y + verticalMargin;
_resultsButton.x += _resultsButton.width / 2;
_detailsButton.x += _detailsButton.width / 2;
_errorsButton.x += _errorsButton.width / 2;
_debugButton.x += _debugButton.width / 2;
+ _restartButton.x += _restartButton.width / 2;

this.addChild(_resultsButton);
this.addChild(_detailsButton);
this.addChild(_errorsButton);
if (_debugButton)
this.addChild(_debugButton);
+ this.addChild(_restartButton);

_resultsButton.addEventListener(MouseEvent.ROLL_OVER, rollOver);
_detailsButton.addEventListener(MouseEvent.ROLL_OVER, rollOver);
_errorsButton.addEventListener(MouseEvent.ROLL_OVER, rollOver);
if (_debugButton)
_debugButton.addEventListener(MouseEvent.ROLL_OVER, rollOver);
+ _restartButton.addEventListener(MouseEvent.ROLL_OVER, rollOver);

_resultsButton.addEventListener(MouseEvent.ROLL_OUT, rollOut);
_detailsButton.addEventListener(MouseEvent.ROLL_OUT, rollOut);
_errorsButton.addEventListener(MouseEvent.ROLL_OUT, rollOut);
if (_debugButton)
_debugButton.addEventListener(MouseEvent.ROLL_OUT, rollOut);
+ _restartButton.addEventListener(MouseEvent.ROLL_OUT, rollOut);

_resultsButton.addEventListener(MouseEvent.CLICK, clickResults);
_detailsButton.addEventListener(MouseEvent.CLICK, clickDetails);
_errorsButton.addEventListener(MouseEvent.CLICK, clickErrors);
if (_debugButton)
_debugButton.addEventListener(MouseEvent.CLICK, clickDebug);
+ _restartButton.addEventListener(MouseEvent.CLICK, clickRestart);

+ changeActiveButton(_resultsButton);
setSummaryResultText();
_resultsTextField.htmlText = _summaryResultText;
}
@@ -313,27 +340,46 @@
}

private function clickResults(e:MouseEvent):void {
+ changeActiveButton(NDTButton(e.target));
_resultsTextField.htmlText = _summaryResultText;
_resultsTextField.scrollV = 0;
- }
+ }

private function clickDetails(e:MouseEvent):void {
+ changeActiveButton(NDTButton(e.target));
_resultsTextField.htmlText = "<font size=\"14\">"
+ TestResults.getResultDetails();
_resultsTextField.scrollV = 0;
}

private function clickDebug(e:MouseEvent):void {
+ changeActiveButton(NDTButton(e.target));
_resultsTextField.htmlText = "<font size=\"14\">"
+ TestResults.getDebugMsg();
_resultsTextField.scrollV = 0;
}

private function clickErrors(e:MouseEvent):void {
+ changeActiveButton(NDTButton(e.target));
_resultsTextField.htmlText = "<font size=\"14\">"
+ TestResults.getErrMsg();
_resultsTextField.scrollV = 0;
}
+
+ private function clickRestart(e:MouseEvent):void {
+ hideResultsScreen();
+ TestResults.clearResults();
+ _consoleText.text = "";
+ this.addChild(_consoleText);
+ _callerObj.startNDTTest();
+ }
+
+ private function changeActiveButton(target:NDTButton):void {
+ if (_activeButton)
+ _activeButton.setInactive();
+ target.setActive();
+ _activeButton = target;
+ }
}
}

@@ -345,6 +391,8 @@
[Embed(source="../assets/hover.png")]
private var ButtonImg:Class;

+ private var _textField:TextField;
+
function NDTButton(text:String, textSize:int, height:int, prop:Number) {
super();
this.buttonMode = true;
@@ -355,9 +403,9 @@
textFormat.bold = true;
textFormat.align = TextFormatAlign.CENTER;
textFormat.color = 0xFFFFFF;
- var textField:TextField = new TextField();
- textField.defaultTextFormat = textFormat;
- textField.text = text;
+ _textField = new TextField();
+ _textField.defaultTextFormat = textFormat;
+ _textField.text = text;

var buttonShape:DisplayObject = new ButtonImg();

@@ -365,15 +413,27 @@
buttonShape.height *= prop;
buttonShape.x -= buttonShape.width / 2;
buttonShape.y -= buttonShape.height / 2;
- textField.width = buttonShape.width;
- textField.height = height;
- textField.x -= textField.width / 2;
- textField.y -= textField.height / 2;
+ _textField.width = buttonShape.width;
+ _textField.height = height;
+ _textField.x -= _textField.width / 2;
+ _textField.y -= _textField.height / 2;

this.addChild(buttonShape);
- this.addChild(textField);
+ this.addChild(_textField);
this.mouseChildren = false;
}
+
+ public function setActive():void {
+ var textFormat:TextFormat = _textField.getTextFormat();
+ textFormat.color = 0x00DBA8;
+ _textField.setTextFormat(textFormat);
+ }
+
+ public function setInactive():void {
+ var textFormat:TextFormat = _textField.getTextFormat();
+ textFormat.color = 0xFFFFFF;
+ _textField.setTextFormat(textFormat);
+ }
}

class ResultsTextField extends TextField {
=======================================
--- /branches/FlashIssue117/flash-client/src/Handshake.as Sun Feb 2 19:14:17 2014 UTC
+++ /branches/FlashIssue117/flash-client/src/Handshake.as Fri Feb 21 08:34:29 2014 UTC
@@ -306,14 +306,14 @@
}

private function failHandshake():void {
- TestResults.appendDebugMsg("Handshake: FAIL.");
+ TestResults.appendDebugMsg("Handshake: FAIL.<br>");

removeOnReceivedDataListener();
_callerObj.failNDTTest();
}

private function endHandshake(confirmedTests:String):void {
- TestResults.appendDebugMsg("Handshake: END.");
+ TestResults.appendDebugMsg("Handshake: END.<br>");

removeOnReceivedDataListener();
_callerObj.initiateTests(confirmedTests);
=======================================
--- /branches/FlashIssue117/flash-client/src/Main.as Thu Feb 20 20:24:05 2014 UTC
+++ /branches/FlashIssue117/flash-client/src/Main.as Fri Feb 21 08:34:29 2014 UTC
@@ -27,6 +27,7 @@
public static var gui:GUI;
public static var server_hostname:String = NDTConstants.SERVER_HOSTNAME;
public static var client_application:String = NDTConstants.CLIENT_ID;
+ public static var ndt_description:String = NDTConstants.NDT_DESCRIPTION;

public function Main():void {
if (stage)
@@ -46,7 +47,7 @@
// Set the properties of the SWF from HTML tags.
NDTUtils.initializeFromHTML(this.root.loaderInfo.parameters);

- var frame:NDTPController = new NDTPController(server_hostname,
+ var frame:NDTPController = new NDTPController(server_hostname,
client_application);

stage.showDefaultContextMenu = false;
=======================================
--- /branches/FlashIssue117/flash-client/src/NDTConstants.as Sun Feb 2 19:14:17 2014 UTC
+++ /branches/FlashIssue117/flash-client/src/NDTConstants.as Fri Feb 21 08:34:29 2014 UTC
@@ -29,6 +29,18 @@
"ndt.iupui.mlab1.nuq0t.measurement-lab.org";
// For localization.
public static const BUNDLE_NAME:String = "DisplayMessages";
+ public static const NDT_DESCRIPTION:String =
+ "Network Diagnostic Tool (NDT) provides a "
+ + "sophisticated speed and diagnostic test. An NDT "
+ + "test reports more than just the upload and "
+ + "download speeds -- it also attempts to determine "
+ + "what, if any, problems limited these speeds, "
+ + "differentiating between computer configuration "
+ + "and network infrastructure problems. While the "
+ + "diagnostic messages are most useful for expert "
+ + "users, they can also help novice users by "
+ + "allowing them to provide detailed trouble "
+ + "reports to their network administrator.";

public static const PROTOCOL_MSG_READ_SUCCESS:int = 0;
public static const PROTOCOL_MSG_READ_ERROR:int = 1;
=======================================
--- /branches/FlashIssue117/flash-client/src/NDTPController.as Thu Feb 20 20:24:05 2014 UTC
+++ /branches/FlashIssue117/flash-client/src/NDTPController.as Fri Feb 21 08:34:29 2014 UTC
@@ -232,7 +232,8 @@
public function succeedNDTTest():void {
TestResults.ndt_test_results::ndtTestFailed = false;
NDTUtils.callExternalFunction("allTestsCompleted");
- TestResults.appendDebugMsg("All the tests completed successfully.");
+ TestResults.appendDebugMsg("<font color=\"#7CFC00\">"
+ + "All the tests completed successfully." + "</font>");
finishNDTTest();
}

=======================================
--- /branches/FlashIssue117/flash-client/src/NDTUtils.as Thu Feb 20 20:24:05 2014 UTC
+++ /branches/FlashIssue117/flash-client/src/NDTUtils.as Fri Feb 21 08:34:29 2014 UTC
@@ -95,6 +95,7 @@
TestResults.appendDebugMsg("Bad Flash permissions: No "
+ "access to javascript.");
}
+
try {
var js_client_application:String =
ExternalInterface.call("getClientApplication");
@@ -109,6 +110,15 @@
TestResults.appendDebugMsg("Bad Flash permissions: No "
+ "access to javascript.");
}
+
+ try {
+ Main.ndt_description = ExternalInterface.call("getNDTDescription");
+ TestResults.appendDebugMsg(
+ "Initialized NDT description from JavaScript:"
+ + Main.ndt_description);
+ } catch(e:Error) {
+ Main.ndt_description = NDTConstants.NDT_DESCRIPTION;
+ }
}

/**
=======================================
--- /branches/FlashIssue117/flash-client/src/TestC2S.as Sun Feb 2 19:14:17 2014 UTC
+++ /branches/FlashIssue117/flash-client/src/TestC2S.as Fri Feb 21 08:34:29 2014 UTC
@@ -423,12 +423,16 @@
TestResults.appendDebugMsg(
ResourceManager.getInstance().getString(
NDTConstants.BUNDLE_NAME, "c2sThroughput", null, Main.locale)
- + " test " + ResourceManager.getInstance().getString(
- NDTConstants.BUNDLE_NAME, "done", null, Main.locale));
+ + " test <font color=\"#7CFC00\"><b>"
+ + ResourceManager.getInstance().getString(
+ NDTConstants.BUNDLE_NAME, "done", null, Main.locale)
+ + "</b></font><br>");
else
- TestResults.appendDebugMsg(ResourceManager.getInstance().getString(
- NDTConstants.BUNDLE_NAME, "c2sThroughputFailed", null,
- Main.locale));
+ TestResults.appendDebugMsg("<font color=\"#FE9A2E\">"
+ + ResourceManager.getInstance().getString(
+ NDTConstants.BUNDLE_NAME, "c2sThroughputFailed",
+ null, Main.locale)
+ + "</font>");
TestResults.ndt_test_results::c2sTestSuccess = _c2sTestSuccess;
TestResults.ndt_test_results::ndtTestStatus = "done";
NDTUtils.callExternalFunction("testCompleted", "ClientToServerThroughput",
=======================================
--- /branches/FlashIssue117/flash-client/src/TestMETA.as Thu Feb 20 20:24:05 2014 UTC
+++ /branches/FlashIssue117/flash-client/src/TestMETA.as Fri Feb 21 08:34:29 2014 UTC
@@ -251,11 +251,15 @@
TestResults.appendDebugMsg(
ResourceManager.getInstance().getString(
NDTConstants.BUNDLE_NAME, "meta", null, Main.locale)
- + " test " + ResourceManager.getInstance().getString(
- NDTConstants.BUNDLE_NAME, "done", null, Main.locale));
+ + " test <font color=\"#7CFC00\"><b>"
+ + ResourceManager.getInstance().getString(
+ NDTConstants.BUNDLE_NAME, "done", null, Main.locale)
+ + "</b></font><br>");
else
- TestResults.appendDebugMsg(ResourceManager.getInstance().getString(
- NDTConstants.BUNDLE_NAME, "metaFailed", null, Main.locale));
+ TestResults.appendDebugMsg("<font color=\"#FE9A2E\">" +
+ ResourceManager.getInstance().getString(
+ NDTConstants.BUNDLE_NAME, "metaFailed", null, Main.locale)
+ + "</font>");

TestResults.ndt_test_results::ndtTestStatus = "done";
NDTUtils.callExternalFunction(
=======================================
--- /branches/FlashIssue117/flash-client/src/TestResults.as Sun Feb 2 19:14:17 2014 UTC
+++ /branches/FlashIssue117/flash-client/src/TestResults.as Fri Feb 21 08:34:29 2014 UTC
@@ -80,16 +80,18 @@
}

public static function appendErrMsg(msg:String):void {
- _errMsg += msg + "\n";
+ _errMsg += "<font color=\"#FE9A2E\"><b>" + msg + "</b></font>" + "\n";
NDTUtils.callExternalFunction("appendErrors", msg);
- appendDebugMsg(msg);
+ appendDebugMsg("<font color=\"#FE9A2E\"><b>" + msg + "</b></font>");
}

public static function appendDebugMsg(msg:String):void {
if (!CONFIG::debug) {
return;
}
- var formattedMsg:String = (new Date().toUTCString()) + ": " + msg + "\n";
+ var formattedMsg:String = "<font size=\"12\">"
+ + (new Date().toUTCString()) + ": "
+ + "</font>" + msg + "\n";
_debugMsg += formattedMsg;
NDTUtils.callExternalFunction("appendDebugOutput", msg);
// _ndtTestStartTime > 0 ensures the console window has been created.
@@ -143,5 +145,27 @@
TestResults.appendResultDetails(s2cTestResults + remoteTestResults);
// TODO(tiziana): If parsing mistake, log message "resultsParseError".
}
+
+ public static function clearResults():void {
+ _ndtTestStartTime = 0.0;
+ _ndtTestEndTime = 0.0;
+ _resultDetails = "";
+ _errMsg = "";
+ _debugMsg = "";
+
+ accessTech = null;
+ linkSpeed = 0.0;
+ ndtVariables = new Object();
+ ndtTestStatus = null;
+ ndtTestFailed = false;
+ c2sSpeed = 0.0;
+ s2cSpeed = 0.0;
+ sc2sSpeed = 0.0;
+ ss2cSpeed = 0.0;
+ s2cTestResults = "";
+ remoteTestResults = "";
+ c2sTestSuccess = false;
+ s2cTestSuccess = false;
+ }
}
}
=======================================
--- /branches/FlashIssue117/flash-client/src/TestS2C.as Sun Feb 2 19:14:17 2014 UTC
+++ /branches/FlashIssue117/flash-client/src/TestS2C.as Fri Feb 21 08:34:29 2014 UTC
@@ -490,12 +490,16 @@
TestResults.appendDebugMsg(
ResourceManager.getInstance().getString(
NDTConstants.BUNDLE_NAME, "s2cThroughput", null, Main.locale)
- + " test " + ResourceManager.getInstance().getString(
- NDTConstants.BUNDLE_NAME, "done", null, Main.locale));
+ + " test <font color=\"#7CFC00\"><b>"
+ + ResourceManager.getInstance().getString(
+ NDTConstants.BUNDLE_NAME, "done", null, Main.locale)
+ + "</b></font><br>");
else
- TestResults.appendDebugMsg(ResourceManager.getInstance().getString(
- NDTConstants.BUNDLE_NAME, "s2cThroughputFailed", null,
- Main.locale));
+ TestResults.appendDebugMsg("<font color=\"#FE9A2E\">" +
+ ResourceManager.getInstance().getString(
+ NDTConstants.BUNDLE_NAME, "s2cThroughputFailed",
+ null, Main.locale)
+ + "</font>");

TestResults.ndt_test_results::s2cTestSuccess = _s2cTestSuccess;
TestResults.ndt_test_results::ndtTestStatus = "done";


  • [ndt-dev] [ndt] r954 committed - Merged latest trunk changes into FlashIssue117 branch, ndt, 02/21/2014

Archive powered by MHonArc 2.6.16.

Top of Page