Index: chrome/test/data/webui/settings/settings_subpage_test.js |
diff --git a/chrome/test/data/webui/settings/settings_subpage_test.js b/chrome/test/data/webui/settings/settings_subpage_test.js |
index ceb88fd39ae613ad841ca9ad32f82466143c262b..bd72e78efe2613bddba8350c87e5276b7986842d 100644 |
--- a/chrome/test/data/webui/settings/settings_subpage_test.js |
+++ b/chrome/test/data/webui/settings/settings_subpage_test.js |
@@ -5,11 +5,13 @@ |
cr.define('settings_subpage', function() { |
function registerTests() { |
suite('SettingsSubpage', function() { |
- test('can navigate to parent', function() { |
+ test('navigates to parent when there is no history', function() { |
PolymerTest.clearBody(); |
- // Choose CERTIFICATES since it is not a descendant of BASIC. |
- settings.navigateTo(settings.Route.CERTIFICATES); |
+ // Pretend that we initially started on the CERTIFICATES route. |
+ window.history.replaceState( |
+ undefined, '', settings.Route.CERTIFICATES.path); |
+ settings.initializeRouteFromUrl(); |
assertEquals(settings.Route.CERTIFICATES, settings.getCurrentRoute()); |
var subpage = document.createElement('settings-subpage'); |
@@ -19,7 +21,7 @@ cr.define('settings_subpage', function() { |
assertEquals(settings.Route.PRIVACY, settings.getCurrentRoute()); |
}); |
- test('can navigate to grandparent using window.back()', function(done) { |
+ test('navigates to any route via window.back()', function(done) { |
PolymerTest.clearBody(); |
settings.navigateTo(settings.Route.BASIC); |
@@ -31,8 +33,6 @@ cr.define('settings_subpage', function() { |
MockInteractions.tap(subpage.$$('paper-icon-button')); |
- // Since the previous history entry is an ancestor, we expect |
- // window.history.back() to be called and a popstate event to be fired. |
window.addEventListener('popstate', function(event) { |
assertEquals(settings.Route.BASIC, settings.getCurrentRoute()); |
done(); |