forked from sanyaade-mobiledev/chromium.src
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfile_unittests.js
37 lines (27 loc) · 1 KB
/
file_unittests.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
define([
"gin/test/expect",
"file"
], function(expect, file) {
function isString(x) {
return toString.call(x) === '[object String]'
}
var rootDir = file.getSourceRootDirectory();
expect(isString(rootDir)).toBeTruthy();
var noArgsNull = file.getFilesInDirectory();
expect(noArgsNull).toBeNull();
var files = file.getFilesInDirectory(rootDir);
expect(Array.isArray(files)).toBeTruthy();
var nsdNull = file.getFilesInDirectory(rootDir + "/no_such_dir");
expect(nsdNull).toBeNull();
var owners = file.readFileToString(rootDir + "/OWNERS");
expect(isString(owners)).toBeTruthy();
expect(owners.length).toBeGreaterThan(0);
noArgsNull = file.readFileToString();
expect(noArgsNull).toBeNull();
var nsfNull = file.readFileToString(rootDir + "/no_such_file");
expect(nsfNull).toBeNull();
this.result = "PASS";
});