1 // Copyright 2014 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 filePassingModule = null;
9 function handleMessage(message) {
10 if (message.data == 'ready') {
11 chrome.test.assertFalse(gotReady);
13 chrome.mediaGalleries.getMediaFileSystems(
14 function(filesystems) {
15 if (filesystems.length != 1) {
16 chrome.test.fail('Wrong number of media galleries: ' +
20 testFilesystem = filesystems[0];
22 'filesystem': testFilesystem,
23 'fullPath': '/test.jpg',
24 'testType': 'read_test'
26 filePassingModule.postMessage(message);
28 } else if (message.data == 'read_success'){
30 'filesystem': testFilesystem,
31 'fullPath': '/test.jpg',
32 'testType': 'write_test'
34 filePassingModule.postMessage(message);
35 } else if (message.data == 'write_success'){
36 chrome.test.succeed();
38 chrome.test.fail(message.data);
42 window.onload = function() {
43 filePassingModule = document.getElementById('nacl_module');
44 filePassingModule.addEventListener('message', handleMessage, false);