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

Unified Diff: chrome/browser/ui/webui/sync_internals_browsertest.js

Issue 160083002: Refactor about:sync's events framework (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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: chrome/browser/ui/webui/sync_internals_browsertest.js
diff --git a/chrome/browser/ui/webui/sync_internals_browsertest.js b/chrome/browser/ui/webui/sync_internals_browsertest.js
index 733bac59692a9f403e9d0809775371cac4b0725f..fc24ef39bb68e76a99df85a0c4ab4fea154b5c78 100644
--- a/chrome/browser/ui/webui/sync_internals_browsertest.js
+++ b/chrome/browser/ui/webui/sync_internals_browsertest.js
@@ -18,6 +18,12 @@ SyncInternalsWebUITest.prototype = {
*/
browsePreload: 'chrome://sync-internals',
+ /**
+ * Disable accessibility testing for this page.
+ * @override
+ */
+ runAccessibilityChecks: false,
+
/** @override */
preLoad: function() {
this.makeAndRegisterMockHandler([
@@ -241,3 +247,49 @@ TEST_F('SyncInternalsWebUITest', 'NodeBrowserRefreshOnTabSelect', function() {
$('sync-browser-tab').selected = true;
expectEquals($('node-browser-refresh-time').textContent, 'TestCanary');
});
+
+// Tests that the events log page correctly receives and displays an event.
+TEST_F('SyncInternalsWebUITest', 'EventLogTest', function() {
+ // Dispatch an event.
+ var connectionEvent = new Event('onConnectionStatusChange');
+ connectionEvent.details = { 'status': 'CONNECTION_OK' }
Dan Beam 2014/02/11 23:21:48 nit: unfortunately (because it differs from C++),
rlarocque 2014/02/12 00:39:55 Done.
+ chrome.sync.events.dispatchEvent(connectionEvent);
+
+ // Verify that it is displayed in the events log.
+ var syncEventsTable = $('sync-events');
+ var firstRow = syncEventsTable.children[0];
+
+ // Makes some assumptions about column ordering. We'll need re-think this if
+ // it turns out to be a maintenance burden.
+ assertLE(4, firstRow.children.length);
Dan Beam 2014/02/12 00:46:19 shouldn't this be assertGE(), btw?
rlarocque 2014/02/12 01:00:46 Let's just go with assertEquals(). If someone add
+ var submoduleName = firstRow.children[1].textContent;
+ var eventName = firstRow.children[2].textContent;
+ var detailsText = firstRow.children[3].textContent;
+
+ assertNotEquals(undefined, submoduleName, firstRow);
Dan Beam 2014/02/11 23:21:48 nit: don't think you need to explicitly say undefi
rlarocque 2014/02/12 00:39:55 Wouldn't that end up comparing submoduleName != fi
Dan Beam 2014/02/12 00:46:19 ah, I see. these checks will never fail AFAIK as
rlarocque 2014/02/12 01:00:46 I think the idea here was to make sure that the DO
+ assertNotEquals(undefined, eventName, firstRow);
+ assertNotEquals(undefined, detailsText, firstRow);
+
+ expectTrue(submoduleName.indexOf('manager') != -1,
+ 'submoduleName=' + submoduleName);
Dan Beam 2014/02/11 23:21:48 nit: expectGE(submoduleName.indexOf('manager'), 0
rlarocque 2014/02/12 00:39:55 Done.
+ expectTrue(eventName.indexOf('onConnectionStatusChange') != -1,
+ 'eventName=' + eventName);
+ expectTrue(detailsText.indexOf('CONNECTION_OK') != -1,
+ 'detailsText=' + detailsText);
+});
+
+TEST_F('SyncInternalsWebUITest', 'DumpSyncEventsToText', function() {
+ // Dispatch an event.
+ var connectionEvent = new Event('onConnectionStatusChange');
+ connectionEvent.details = { 'status': 'CONNECTION_OK' }
+ chrome.sync.events.dispatchEvent(connectionEvent);
+
+ // Click the dump-to-text button.
+ $('dump-to-text').click();
+
+ // Verify our event is among the results.
+ var eventDumpText = $('data-dump').textContent;
+
+ expectTrue(eventDumpText.indexOf('onConnectionStatusChange') != -1);
+ expectTrue(eventDumpText.indexOf('CONNECTION_OK') != -1);
+});

Powered by Google App Engine
This is Rietveld 408576698