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

Side by Side Diff: chrome/test/data/extensions/api_test/dial/experimental/runtest.js

Issue 11444020: DIAL extension API skeleton. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: abc.... Created 8 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 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.
4
5 // Array of each device list update.
6 var devices = [];
7
8 chrome.test.sendMessage('ready', function(message) {
9 if (message == 'setup') {
10 function handleOnDeviceList(deviceList) {
11 var newDevices = [];
12 for (var i = 0; i < deviceList.length; ++i) {
13 newDevices.push(deviceList[i]);
14 }
15 devices.push(newDevices);
16 }
17 chrome.dial.onDeviceList.addListener(handleOnDeviceList);
18
19 chrome.test.sendMessage('setup', function(message) {
20 if (message == 'go') {
21 chrome.test.runTests([
22 function testEvents() {
23 // Make sure there were 3 devices.
24 chrome.test.assertEq(3, devices.length);
25
26 // Make sure each update contained 1 more device than the previous.
27 for (var i = 0; i < devices.length; ++i) {
28 chrome.test.assertEq(i + 1, devices[i].length);
29 }
30
31 // Just check the first device in the first update and the last
32 // device in the last update.
33 // Not exposing the device id right now.
34 chrome.test.assertTrue(!('deviceId' in devices[0][0]));
35 chrome.test.assertEq("1", devices[0][0].deviceLabel);
36 chrome.test.assertEq("http://1",
37 devices[0][0].deviceDescriptionUrl);
38
39 chrome.test.assertTrue(!('deviceId' in devices[2][2]));
40 chrome.test.assertEq("3", devices[2][2].deviceLabel);
41 chrome.test.assertEq("http://3",
42 devices[2][2].deviceDescriptionUrl);
43
44 chrome.test.succeed();
45 }
46 ]);
47 }
48 });
49 }
50 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698