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

Unified Diff: ui/file_manager/file_manager/common/js/importer_common_unittest.js

Issue 925233004: A grab-bag of small improvements (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Respond to review comments. Created 5 years, 10 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: ui/file_manager/file_manager/common/js/importer_common_unittest.js
diff --git a/ui/file_manager/file_manager/common/js/importer_common_unittest.js b/ui/file_manager/file_manager/common/js/importer_common_unittest.js
index 63d020e6f2b04ac5ae585923d225c1c099ae71c8..c531c16db683d069020274ef832a16cf1fa94eae 100644
--- a/ui/file_manager/file_manager/common/js/importer_common_unittest.js
+++ b/ui/file_manager/file_manager/common/js/importer_common_unittest.js
@@ -31,6 +31,9 @@ loadTimeData.data = {
// Set up the test components.
function setUp() {
+
+ new MockChromeStorageAPI();
+
var cameraFileSystem = new MockFileSystem(
'camera-fs', 'filesystem:camera-123');
var sdFileSystem = new MockFileSystem(
@@ -104,9 +107,7 @@ function testResolver_Reject(callback) {
});
}
-function testGetMachineId(callback) {
- var storage = new MockChromeStorageAPI();
-
+function testGetMachineId_Persisted(callback) {
var promise = importer.getMachineId().then(
function(firstMachineId) {
assertTrue(100000 <= firstMachineId <= 9999999);
@@ -119,16 +120,12 @@ function testGetMachineId(callback) {
}
function testPhotosApp_DefaultDisabled(callback) {
- var storage = new MockChromeStorageAPI();
-
var promise = importer.isPhotosAppImportEnabled().then(assertFalse);
reportPromise(promise, callback);
}
function testPhotosApp_ImportEnabled(callback) {
- var storage = new MockChromeStorageAPI();
-
var promise = importer.handlePhotosAppMessage(true).then(
function() {
return importer.isPhotosAppImportEnabled().then(assertTrue);
@@ -138,8 +135,6 @@ function testPhotosApp_ImportEnabled(callback) {
}
function testPhotosApp_ImportDisabled(callback) {
- var storage = new MockChromeStorageAPI();
-
var promise = importer.handlePhotosAppMessage(false).then(
function() {
return importer.isPhotosAppImportEnabled().then(assertFalse);
@@ -149,8 +144,6 @@ function testPhotosApp_ImportDisabled(callback) {
}
function testHistoryFilename(callback) {
- var storage = new MockChromeStorageAPI();
-
var promise = importer.getHistoryFilename().then(
function(firstName) {
assertTrue(!!firstName && firstName.length > 10);
@@ -163,6 +156,24 @@ function testHistoryFilename(callback) {
reportPromise(promise, callback);
}
+function testLocalStorageWrapper(callback) {
+ var storage = new importer.ChromeLocalStorage();
+ var promise = Promise.all([
+ storage.set('lamb', 'chop'),
+ storage.set('isPoodle', true),
+ storage.set('age of grandma', 103)
+ ]).then(
+ function() {
+ return Promise.all([
+ storage.get('lamb').then(assertEquals.bind(null, 'chop')),
+ storage.get('isPoodle').then(assertEquals.bind(null, true)),
+ storage.get('age of grandma').then(assertEquals.bind(null, 103))
+ ]);
+ });
+
+ reportPromise(promise, callback);
+}
+
/** @param {string} path */
function assertIsMediaDir(path) {
var dir = createDirectoryEntry(sdVolume, path);

Powered by Google App Engine
This is Rietveld 408576698