- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / test / data / extensions / api_test / sync_file_system / on_file_status_changed / test.js
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 function setupListener() {
6   chrome.syncFileSystem.onFileStatusChanged.addListener(fileInfoReceived);
7   chrome.syncFileSystem.requestFileSystem(function() {});
8 }
9
10 function fileInfoReceived(fileInfo) {
11   // FileEntry object fields.
12   var fileEntry = fileInfo.fileEntry;
13   chrome.test.assertEq("foo.txt", fileEntry.name);
14   chrome.test.assertEq("/foo.txt", fileEntry.fullPath);
15   chrome.test.assertTrue(fileEntry.isFile);
16   chrome.test.assertFalse(fileEntry.isDirectory);
17
18   chrome.test.assertEq("synced", fileInfo.status);
19   chrome.test.assertEq("added", fileInfo.action);
20   chrome.test.assertEq("remote_to_local", fileInfo.direction);
21   chrome.test.succeed();
22 }
23
24 chrome.test.runTests([
25   setupListener
26 ]);