1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 var $ = document.getElementById.bind(document);
7 function checkOneDevice() {
8 var devices = $('register-device-list').children;
9 assertEquals(1, devices.length);
10 var firstDevice = devices[0];
12 assertDomElementIsSamplePrinter(firstDevice);
15 function checkNoDevices() {
16 assertEquals(0, $('register-device-list').children.length);
19 function registerShowOverlay() {
20 var button = document.querySelector('#register-device-list button');
21 var overlay = $('overlay');
23 assertTrue(button != null);
25 assertTrue(overlay.hidden);
27 assertFalse(overlay.hidden);
29 assertFalse($('register-page-confirm').hidden);
32 function registerBegin() {
33 var button = $("register-continue-button");
34 assertTrue(button != null);
36 assertFalse($('register-page-confirm').hidden);
38 assertTrue($('register-page-confirm').hidden);
39 assertFalse($('register-printer-page-adding1').hidden);
42 function expectPageAdding1() {
43 assertFalse($('register-printer-page-adding1').hidden);
46 function expectPageAdding2() {
47 assertFalse($('register-page-adding2').hidden);
50 function expectRegisterDone() {
51 assertTrue($('overlay').hidden);
52 var cloudDevices = $('cloud-devices');
53 var firstDevice = cloudDevices.firstChild;
54 assertDomElementIsSamplePrinter(firstDevice);
57 function assertDomElementIsSamplePrinter(device) {
58 var deviceName = device.querySelector('.device-name').textContent;
59 assertEquals('Sample device', deviceName);
61 var deviceDescription =
62 device.querySelector('.device-subline').textContent;
63 assertEquals('Sample device description', deviceDescription);
65 var button = device.querySelector('button');
66 // Button should not be disabled since there is a logged in user.
67 assertFalse(button.disabled);