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

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

Issue 2555373003: MD Settings: Deactivate the Camera when leaving the Change Picture page. (Closed)
Patch Set: fix closure compile Created 4 years 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 | « chrome/browser/resources/settings/people_page/compiled_resources2.gyp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_people_page_change_picture', function() { 5 cr.define('settings_people_page_change_picture', function() {
6 /** 6 /**
7 * @constructor 7 * @constructor
8 * @implements {settings.ChangePictureBrowserProxy} 8 * @implements {settings.ChangePictureBrowserProxy}
9 * @extends {settings.TestBrowserProxy} 9 * @extends {settings.TestBrowserProxy}
10 */ 10 */
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 settings.ChangePictureBrowserProxyImpl.instance_ = browserProxy; 100 settings.ChangePictureBrowserProxyImpl.instance_ = browserProxy;
101 PolymerTest.clearBody(); 101 PolymerTest.clearBody();
102 changePicture = document.createElement('settings-change-picture'); 102 changePicture = document.createElement('settings-change-picture');
103 document.body.appendChild(changePicture); 103 document.body.appendChild(changePicture);
104 104
105 settingsCamera = changePicture.$$('settings-camera'); 105 settingsCamera = changePicture.$$('settings-camera');
106 assertTrue(!!settingsCamera); 106 assertTrue(!!settingsCamera);
107 discardControlBar = changePicture.$.discardControlBar; 107 discardControlBar = changePicture.$.discardControlBar;
108 assertTrue(!!discardControlBar); 108 assertTrue(!!discardControlBar);
109 109
110 changePicture.currentRouteChanged(settings.Route.CHANGE_PICTURE);
111
110 return browserProxy.whenCalled('initialize').then(function() { 112 return browserProxy.whenCalled('initialize').then(function() {
111 Polymer.dom.flush(); 113 Polymer.dom.flush();
112 }); 114 });
113 }); 115 });
114 116
115 teardown(function() { changePicture.remove(); }); 117 teardown(function() { changePicture.remove(); });
116 118
117 test('ChangePictureSelectCamera', function() { 119 test('ChangePictureSelectCamera', function() {
118 var cameraIcon = changePicture.$.cameraImage; 120 var cameraIcon = changePicture.$.cameraImage;
119 assertTrue(!!cameraIcon); 121 assertTrue(!!cameraIcon);
(...skipping 12 matching lines...) Expand all
132 expectFalse(settingsCamera.cameraActive); 134 expectFalse(settingsCamera.cameraActive);
133 135
134 MockInteractions.tap(cameraIcon); 136 MockInteractions.tap(cameraIcon);
135 137
136 Polymer.dom.flush(); 138 Polymer.dom.flush();
137 expectFalse(cameraIcon.hidden); 139 expectFalse(cameraIcon.hidden);
138 expectTrue(settingsCamera.cameraActive); 140 expectTrue(settingsCamera.cameraActive);
139 expectEquals(ChangePictureSelectionTypes.CAMERA, 141 expectEquals(ChangePictureSelectionTypes.CAMERA,
140 getSelectedItem().dataset.type); 142 getSelectedItem().dataset.type);
141 expectTrue(discardControlBar.hidden); 143 expectTrue(discardControlBar.hidden);
144
145 // Ensure that the camera is deactivated if user navigates away.
146 changePicture.currentRouteChanged(settings.Route.BASIC);
147 expectFalse(settingsCamera.cameraActive);
142 }); 148 });
143 149
144 test('ChangePictureProfileImage', function() { 150 test('ChangePictureProfileImage', function() {
145 var profileImage = changePicture.$.profileImage; 151 var profileImage = changePicture.$.profileImage;
146 assertTrue(!!profileImage); 152 assertTrue(!!profileImage);
147 153
148 expectEquals(null, getSelectedItem()); 154 expectEquals(null, getSelectedItem());
149 MockInteractions.tap(profileImage); 155 MockInteractions.tap(profileImage);
150 156
151 return browserProxy.whenCalled('selectProfileImage').then(function() { 157 return browserProxy.whenCalled('selectProfileImage').then(function() {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 }); 227 });
222 }); 228 });
223 } 229 }
224 230
225 return { 231 return {
226 registerTests: function() { 232 registerTests: function() {
227 registerChangePictureTests(); 233 registerChangePictureTests();
228 }, 234 },
229 }; 235 };
230 }); 236 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/settings/people_page/compiled_resources2.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698