Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / extensions / test / data / system / storage_attachment / test_storage_api.js
blobe450493bf9def10687c4add885cfd4823d964c33
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 // system.storage api test
6 // extensions_browsertests --gtest_filter=SystemStorageApiTest.Storage
8 // Testing data should be the same as |kRemovableStorageData| in
9 // test_storage_info_provider.cc.
10 var testData = {
11 id: "transient:0004",
12 name: "/media/usb1",
13 type: "removable",
14 capacity: 4098
17 var device_id;
19 chrome.test.runTests([
20 function testAttachedEvent() {
21 chrome.test.listenOnce(
22 chrome.system.storage.onAttached,
23 function listener(info) {
24 // Record the transient id.
25 device_id = info.id;
26 chrome.test.assertEq(testData.name, info.name);
27 chrome.test.assertEq(testData.type, info.type);
28 chrome.test.assertEq(testData.capacity, info.capacity);
32 // Tell browser process to attach a new removable storage.
33 chrome.test.sendMessage("attach");
36 function testDetachedEvent() {
37 chrome.test.listenOnce(
38 chrome.system.storage.onDetached,
39 function listener(id) {
40 chrome.test.assertEq(device_id, id);
41 chrome.test.sendMessage(id);
44 // Tell browser process to detach a storage.
45 chrome.test.sendMessage("detach");
47 ]);