| OLD | NEW |
| 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('device_page_tests', function() { | 5 cr.define('device_page_tests', function() { |
| 6 /** @enum {string} */ | 6 /** @enum {string} */ |
| 7 var TestNames = { | 7 var TestNames = { |
| 8 DevicePage: 'device page', | 8 DevicePage: 'device page', |
| 9 Display: 'display', | 9 Display: 'display', |
| 10 Keyboard: 'keyboard', | 10 Keyboard: 'keyboard', |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 suite('SettingsDevicePage', function() { | 135 suite('SettingsDevicePage', function() { |
| 136 /** @type {!SettingsDevicePage|undefined} */ | 136 /** @type {!SettingsDevicePage|undefined} */ |
| 137 var devicePage; | 137 var devicePage; |
| 138 | 138 |
| 139 /** @type {!FakeSystemDisplay|undefined} */ | 139 /** @type {!FakeSystemDisplay|undefined} */ |
| 140 var fakeSystemDisplay; | 140 var fakeSystemDisplay; |
| 141 | 141 |
| 142 suiteSetup(function() { | 142 suiteSetup(function() { |
| 143 // Disable animations so sub-pages open within one event loop. | 143 // Disable animations so sub-pages open within one event loop. |
| 144 testing.Test.disableAnimationsAndTransitions(); | 144 testing.Test.disableAnimationsAndTransitions(); |
| 145 |
| 146 // Update the device page route for navigations. |
| 147 // TODO(tommycli): Remove once settings.navigateTo is no longer a stub. |
| 148 settings.navigateTo = function(route) { |
| 149 devicePage.currentRoute = route; |
| 150 }; |
| 145 }); | 151 }); |
| 146 | 152 |
| 147 setup(function(done) { | 153 setup(function(done) { |
| 148 fakeSystemDisplay = new settings.FakeSystemDisplay(); | 154 fakeSystemDisplay = new settings.FakeSystemDisplay(); |
| 149 settings.display.systemDisplayApi = fakeSystemDisplay; | 155 settings.display.systemDisplayApi = fakeSystemDisplay; |
| 150 | 156 |
| 151 PolymerTest.clearBody(); | 157 PolymerTest.clearBody(); |
| 152 devicePage = document.createElement('settings-device-page'); | 158 devicePage = document.createElement('settings-device-page'); |
| 153 devicePage.currentRoute = {page: 'basic', section: '', subpage: []}; | 159 devicePage.currentRoute = settings.Route.BASIC; |
| 154 devicePage.prefs = getFakePrefs(); | 160 devicePage.prefs = getFakePrefs(); |
| 155 settings.DevicePageBrowserProxyImpl.instance_ = | 161 settings.DevicePageBrowserProxyImpl.instance_ = |
| 156 new TestDevicePageBrowserProxy(); | 162 new TestDevicePageBrowserProxy(); |
| 157 | 163 |
| 158 // settings-animated-pages expects a parent with data-page set. | 164 // settings-animated-pages expects a parent with data-page set. |
| 159 var basicPage = document.createElement('div'); | 165 var basicPage = document.createElement('div'); |
| 160 basicPage.dataset.page = 'basic'; | 166 basicPage.dataset.page = 'basic'; |
| 161 basicPage.appendChild(devicePage); | 167 basicPage.appendChild(devicePage); |
| 162 document.body.appendChild(basicPage); | 168 document.body.appendChild(basicPage); |
| 163 | 169 |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 expectTrue(displayPage.showMirror_(displayPage.displays)); | 519 expectTrue(displayPage.showMirror_(displayPage.displays)); |
| 514 expectTrue(displayPage.isMirrored_(displayPage.displays)); | 520 expectTrue(displayPage.isMirrored_(displayPage.displays)); |
| 515 }); | 521 }); |
| 516 }); | 522 }); |
| 517 }); | 523 }); |
| 518 | 524 |
| 519 return { | 525 return { |
| 520 TestNames: TestNames | 526 TestNames: TestNames |
| 521 }; | 527 }; |
| 522 }); | 528 }); |
| OLD | NEW |