Commit f6b1088e authored by Aran Gilman's avatar Aran Gilman Committed by Commit Bot

Use Chai for assertions in Reader Mode's JS tests.

Bug: 1027612
Change-Id: Id22e86cb78ba35af83a46a27b46a01227fce2c0d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2163328Reviewed-by: default avatarWei-Yin Chen (陳威尹) <wychen@chromium.org>
Reviewed-by: default avatarMeredith Lane <meredithl@chromium.org>
Commit-Queue: Aran Gilman <gilmanmh@google.com>
Cr-Commit-Position: refs/heads/master@{#766498}
parent 6d2c8958
...@@ -562,6 +562,7 @@ if (!is_ios && !is_fuchsia) { ...@@ -562,6 +562,7 @@ if (!is_ios && !is_fuchsia) {
"dom_distiller/core/javascript/", "dom_distiller/core/javascript/",
"security_state/content/testdata/", "security_state/content/testdata/",
"//content/test/data/", "//content/test/data/",
"//third_party/chaijs",
"//third_party/dom_distiller_js/dist/test/data/", "//third_party/dom_distiller_js/dist/test/data/",
"//third_party/mocha", "//third_party/mocha",
] ]
......
...@@ -44,6 +44,7 @@ void SetUpTestServerWithoutStarting(EmbeddedTestServer* server) { ...@@ -44,6 +44,7 @@ void SetUpTestServerWithoutStarting(EmbeddedTestServer* server) {
root_dir.AppendASCII("components/dom_distiller/core/javascript")); root_dir.AppendASCII("components/dom_distiller/core/javascript"));
server->ServeFilesFromDirectory( server->ServeFilesFromDirectory(
root_dir.AppendASCII("components/test/data/dom_distiller")); root_dir.AppendASCII("components/test/data/dom_distiller"));
server->ServeFilesFromDirectory(root_dir.AppendASCII("third_party/chaijs"));
server->ServeFilesFromDirectory(root_dir.AppendASCII("third_party/mocha")); server->ServeFilesFromDirectory(root_dir.AppendASCII("third_party/mocha"));
} }
...@@ -60,6 +61,9 @@ FakeDistilledPage::FakeDistilledPage(EmbeddedTestServer* server) ...@@ -60,6 +61,9 @@ FakeDistilledPage::FakeDistilledPage(EmbeddedTestServer* server)
// DomDistillerRequestViewBase::SendCommonJavaScript(); however, this method // DomDistillerRequestViewBase::SendCommonJavaScript(); however, this method
// is impractical to use in testing. // is impractical to use in testing.
AppendScriptFile("dom_distiller_viewer.js"); AppendScriptFile("dom_distiller_viewer.js");
// Also load test helper scripts.
AppendScriptFile("chai.js");
AppendScriptFile("mocha.js"); AppendScriptFile("mocha.js");
AppendScriptFile("test_util.js"); AppendScriptFile("test_util.js");
} }
......
...@@ -12,6 +12,7 @@ function TestReporter(runner) { ...@@ -12,6 +12,7 @@ function TestReporter(runner) {
passes++; passes++;
}); });
// TODO(crbug.com/1027612): Show diff between actual and expected results.
runner.on('fail', function(test, err) { runner.on('fail', function(test, err) {
failures++; failures++;
let message = 'Mocha test failed: ' + test.fullTitle() + '\n'; let message = 'Mocha test failed: ' + test.fullTitle() + '\n';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment