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

Side by Side Diff: chrome/test/data/webui/settings/about_page_tests.js

Issue 2341493003: MD Settings: Deflake attempt for CrSettingsPrivacyPageTest.PrivacyPage. (Closed)
Patch Set: Check for specific value. Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/test/data/webui/settings/certificate_manager_page_test.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 cr.define('settings_about_page', function() { 5 cr.define('settings_about_page', function() {
6 /** 6 /**
7 * @constructor 7 * @constructor
8 * @implements {settings.AboutPageBrowserProxy} 8 * @implements {settings.AboutPageBrowserProxy}
9 * @extends {settings.TestBrowserProxy} 9 * @extends {settings.TestBrowserProxy}
10 */ 10 */
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 checkChangeChannelButton(true); 599 checkChangeChannelButton(true);
600 }); 600 });
601 601
602 test('ChangeChannel_Disabled', function() { 602 test('ChangeChannel_Disabled', function() {
603 checkChangeChannelButton(false); 603 checkChangeChannelButton(false);
604 }); 604 });
605 }); 605 });
606 } 606 }
607 607
608 function registerChannelSwitcherDialogTests() { 608 function registerChannelSwitcherDialogTests() {
609 /**
610 * Converts an event occurrence to a promise.
611 * @param {string} eventType
612 * @param {!HTMLElement} target
613 * @return {!Promise} A promise firing once the event occurs.
614 * TODO(dpapad); Share this code with certificate_manager_page_test.js
615 * identical helper method.
616 */
617 function eventToPromise(eventType, target) {
618 return new Promise(function(resolve, reject) {
619 target.addEventListener(eventType, resolve);
620 });
621 }
622
623 suite('ChannelSwitcherDialogTest', function() { 609 suite('ChannelSwitcherDialogTest', function() {
624 var dialog = null; 610 var dialog = null;
625 var radioButtons = null; 611 var radioButtons = null;
626 var browserProxy = null; 612 var browserProxy = null;
627 var currentChannel = BrowserChannel.BETA; 613 var currentChannel = BrowserChannel.BETA;
628 614
629 setup(function() { 615 setup(function() {
630 browserProxy = new TestAboutPageBrowserProxy(); 616 browserProxy = new TestAboutPageBrowserProxy();
631 browserProxy.setChannels(currentChannel, currentChannel); 617 browserProxy.setChannels(currentChannel, currentChannel);
632 settings.AboutPageBrowserProxyImpl.instance_ = browserProxy; 618 settings.AboutPageBrowserProxyImpl.instance_ = browserProxy;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 test('ChangeChannel_LessStable', function() { 650 test('ChangeChannel_LessStable', function() {
665 assertEquals(BrowserChannel.DEV, radioButtons.item(2).name); 651 assertEquals(BrowserChannel.DEV, radioButtons.item(2).name);
666 MockInteractions.tap(radioButtons.item(2)); 652 MockInteractions.tap(radioButtons.item(2));
667 Polymer.dom.flush(); 653 Polymer.dom.flush();
668 654
669 assertFalse(dialog.$.warning.hidden); 655 assertFalse(dialog.$.warning.hidden);
670 // Check that only the "Change channel" button becomes visible. 656 // Check that only the "Change channel" button becomes visible.
671 assertTrue(dialog.$.changeChannelAndPowerwash.hidden); 657 assertTrue(dialog.$.changeChannelAndPowerwash.hidden);
672 assertFalse(dialog.$.changeChannel.hidden); 658 assertFalse(dialog.$.changeChannel.hidden);
673 659
674 var whenTargetChannelChangedFired = eventToPromise( 660 var whenTargetChannelChangedFired = test_util.eventToPromise(
675 'target-channel-changed', dialog); 661 'target-channel-changed', dialog);
676 662
677 MockInteractions.tap(dialog.$.changeChannel); 663 MockInteractions.tap(dialog.$.changeChannel);
678 return browserProxy.whenCalled('setChannel').then(function(args) { 664 return browserProxy.whenCalled('setChannel').then(function(args) {
679 assertEquals(BrowserChannel.DEV, args[0]); 665 assertEquals(BrowserChannel.DEV, args[0]);
680 assertFalse(args[1]); 666 assertFalse(args[1]);
681 return whenTargetChannelChangedFired; 667 return whenTargetChannelChangedFired;
682 }).then(function(event) { 668 }).then(function(event) {
683 assertEquals(BrowserChannel.DEV, event.detail); 669 assertEquals(BrowserChannel.DEV, event.detail);
684 }); 670 });
685 }); 671 });
686 672
687 // Test case where user switches to a more stable channel. 673 // Test case where user switches to a more stable channel.
688 test('ChangeChannel_MoreStable', function() { 674 test('ChangeChannel_MoreStable', function() {
689 assertEquals(BrowserChannel.STABLE, radioButtons.item(0).name); 675 assertEquals(BrowserChannel.STABLE, radioButtons.item(0).name);
690 MockInteractions.tap(radioButtons.item(0)); 676 MockInteractions.tap(radioButtons.item(0));
691 Polymer.dom.flush(); 677 Polymer.dom.flush();
692 678
693 assertFalse(dialog.$.warning.hidden); 679 assertFalse(dialog.$.warning.hidden);
694 // Check that only the "Change channel and Powerwash" button becomes 680 // Check that only the "Change channel and Powerwash" button becomes
695 // visible. 681 // visible.
696 assertFalse(dialog.$.changeChannelAndPowerwash.hidden); 682 assertFalse(dialog.$.changeChannelAndPowerwash.hidden);
697 assertTrue(dialog.$.changeChannel.hidden); 683 assertTrue(dialog.$.changeChannel.hidden);
698 684
699 var whenTargetChannelChangedFired = eventToPromise( 685 var whenTargetChannelChangedFired = test_util.eventToPromise(
700 'target-channel-changed', dialog); 686 'target-channel-changed', dialog);
701 687
702 MockInteractions.tap(dialog.$.changeChannelAndPowerwash); 688 MockInteractions.tap(dialog.$.changeChannelAndPowerwash);
703 return browserProxy.whenCalled('setChannel').then(function(args) { 689 return browserProxy.whenCalled('setChannel').then(function(args) {
704 assertEquals(BrowserChannel.STABLE, args[0]); 690 assertEquals(BrowserChannel.STABLE, args[0]);
705 assertTrue(args[1]); 691 assertTrue(args[1]);
706 return whenTargetChannelChangedFired; 692 return whenTargetChannelChangedFired;
707 }).then(function(event) { 693 }).then(function(event) {
708 assertEquals(BrowserChannel.STABLE, event.detail); 694 assertEquals(BrowserChannel.STABLE, event.detail);
709 }); 695 });
710 }); 696 });
711 }); 697 });
712 } 698 }
713 } 699 }
714 700
715 return { 701 return {
716 registerTests: function() { 702 registerTests: function() {
717 if (cr.isChromeOS) { 703 if (cr.isChromeOS) {
718 registerDetailedBuildInfoTests(); 704 registerDetailedBuildInfoTests();
719 registerChannelSwitcherDialogTests(); 705 registerChannelSwitcherDialogTests();
720 } 706 }
721 registerAboutPageTests(); 707 registerAboutPageTests();
722 }, 708 },
723 registerOfficialBuildTests: registerOfficialBuildTests, 709 registerOfficialBuildTests: registerOfficialBuildTests,
724 }; 710 };
725 }); 711 });
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/webui/settings/certificate_manager_page_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698