Bug 505591 - Add test cases for Browser.evaluate() to browser test
suite. 

Refactoring some test cases.
In a previous commit I accidentally made it so there would be no way for
tests to fail. This fixes it.

Change-Id: Ib371d9a62f03c2c5e6ddc3677a9b8370e7c833f4
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=503431
Signed-off-by: Leo Ufimtsev <lufimtse@redhat.com>
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_Browser.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_Browser.java
index bf59648..eb05a66 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_Browser.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_Browser.java
@@ -690,15 +690,13 @@
 
 	browser.setText("<html><body><p id='myid'>HelloWorld</p></body></html>");
 	shell.open();
-	boolean passed = false;
 	for (int i = 0; i < (loopMultipier * secondsToWaitTillFail); i++) {  // Wait up to seconds before declaring test as failed.
 		runLoopTimer(waitMS);
 		if ("HelloWorld".equals(returnValue.get())) {
-			passed = true;
-			break;
+			return; // passed.
 		}
 	}
-	assertTrue(passed);
+	fail();
 }
 
 /**
@@ -790,6 +788,7 @@
 			return; // passed.
 		}
 	}
+	fail();
 }
 
 /**
@@ -822,6 +821,7 @@
 			return; // passed
 		}
 	}
+	fail();
 }
 
 /**
@@ -853,16 +853,15 @@
 
 	browser.setText("<html><body>HelloWorld</body></html>");
 	shell.open();
-	boolean passed = false;
 	for (int i = 0; i < (loopMultipier * secondsToWaitTillFail); i++) {  // Wait up to seconds before declaring test as failed.
 		runLoopTimer(waitMS);
 		if (exception.get() != -1) {
 			if (exception.get() == SWT.ERROR_INVALID_RETURN_VALUE) {
-				passed = true;
+				return; // passed.
 			} else if (exception.get() == SWT.ERROR_FAILED_EVALUATE) {
 				System.err.println("SWT Warning: test_evaluate_invalid_return_value threw wrong exception code."
 						+ " Expected ERROR_INVALID_RETURN_VALUE but got ERROR_FAILED_EVALUATE");
-				passed = true;
+				return; // passed.
 				// Webkit1 is known to throw the wrong exception.
 			} else  {
 				System.err.println("test_evaluate_invalid_return_value - Invalid exception code : " + exception.get());
@@ -870,7 +869,7 @@
 			break;
 		}
 	}
-	assertTrue(passed);
+	fail();
 }
 
 /**
@@ -906,6 +905,7 @@
 			break;
 		}
 	}
+	fail();
 }
 
 /**
@@ -946,6 +946,7 @@
 			}
 		}
 	}
+	fail();
 }
 
 /**
@@ -985,6 +986,7 @@
 			}
 		}
 	}
+	fail();
 }
 
 /**
@@ -1025,6 +1027,7 @@
 			}
 		}
 	}
+	fail();
 }
 
 /* custom */