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

Unified Diff: chrome/test/data/webui/md_history/history_synced_tabs_test.js

Issue 2220303002: MD History: Show 'no synced tabs' when tab sync is disabled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: minor change Created 4 years, 4 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
« no previous file with comments | « chrome/browser/resources/md_history/synced_device_manager.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/webui/md_history/history_synced_tabs_test.js
diff --git a/chrome/test/data/webui/md_history/history_synced_tabs_test.js b/chrome/test/data/webui/md_history/history_synced_tabs_test.js
index 17b0c4ebefaa60e25b7555211793709d80fe556b..757b0c10daba160bf2289087549bdaf72eb051fa 100644
--- a/chrome/test/data/webui/md_history/history_synced_tabs_test.js
+++ b/chrome/test/data/webui/md_history/history_synced_tabs_test.js
@@ -40,7 +40,15 @@ cr.define('md_history.history_synced_tabs_test', function() {
var getCards = function() {
return Polymer.dom(element.root).
querySelectorAll('history-synced-device-card');
- }
+ };
+
+ var assertNoSyncedTabsMessageShown = function(stringID) {
+ assertFalse(element.$['no-synced-tabs'].hidden);
+ var message = loadTimeData.getString(stringID);
+ assertNotEquals(
+ -1,
+ element.$['no-synced-tabs'].textContent.indexOf(message));
+ };
suiteSetup(function() {
app = $('history-app');
@@ -233,10 +241,7 @@ cr.define('md_history.history_synced_tabs_test', function() {
return flush();
}).then(function() {
// When user signs in, first show loading message.
- assertFalse(element.$['no-synced-tabs'].hidden);
- var loading = loadTimeData.getString('loading');
- assertNotEquals(
- -1, element.$['no-synced-tabs'].textContent.indexOf(loading));
+ assertNoSyncedTabsMessageShown('loading');
var sessionList = [];
setForeignSessions(sessionList, true);
@@ -245,13 +250,9 @@ cr.define('md_history.history_synced_tabs_test', function() {
cards = getCards();
assertEquals(0, cards.length);
// If no synced tabs are fetched, show 'no synced tabs'.
- assertFalse(element.$['no-synced-tabs'].hidden);
- var noSyncedResults = loadTimeData.getString('noSyncedResults');
- assertNotEquals(
- -1,
- element.$['no-synced-tabs'].textContent.indexOf(noSyncedResults));
+ assertNoSyncedTabsMessageShown('noSyncedResults');
- var sessionList = [
+ sessionList = [
createSession(
'Nexus 5',
[createWindow(['http://www.google.com', 'http://example.com'])]
@@ -274,6 +275,34 @@ cr.define('md_history.history_synced_tabs_test', function() {
});
});
+ test('enable and disable tab sync', function() {
+ updateSignInState(true);
+ var sessionList = [
+ createSession(
+ 'Nexus 5',
+ [createWindow(['http://www.google.com', 'http://example.com'])]
+ )
+ ];
+ // Open tabs sync is enabled.
+ setForeignSessions(sessionList, true);
+
+ return flush().then(function() {
+ var cards = getCards();
+ assertEquals(1, cards.length);
+ assertTrue(element.$['no-synced-tabs'].hidden);
+
+ // Open tabs sync is disabled.
+ setForeignSessions(sessionList, false);
+
+ return flush();
+ }).then(function() {
+ cards = getCards();
+ assertEquals(0, cards.length);
+ // If tab sync is disabled, show 'no synced tabs'.
+ assertNoSyncedTabsMessageShown('noSyncedResults');
+ });
+ });
+
test('hide sign in promo in guest mode', function() {
element.guestSession_ = true;
return flush().then(function() {
« no previous file with comments | « chrome/browser/resources/md_history/synced_device_manager.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698