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

Unified Diff: gin/test/file_unittests.js

Issue 419673004: gin test - add simple file access for JS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add null return tests for no-args and non-existant paths Created 6 years, 5 months 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 side-by-side diff with in-line comments
Download patch
Index: gin/test/file_unittests.js
diff --git a/gin/test/file_unittests.js b/gin/test/file_unittests.js
new file mode 100644
index 0000000000000000000000000000000000000000..8c25806e13994e2b48e53a2c3b0897d1030b1ae9
--- /dev/null
+++ b/gin/test/file_unittests.js
@@ -0,0 +1,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";
+});
« gin/test/file.cc ('K') | « gin/test/file_runner.cc ('k') | gin/test/run_js_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698