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

Side by Side Diff: chrome/browser/resources/chromeos/wallpaper_manager/js/util.js

Issue 642943002: Add tests for sync custom wallpaper feature (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge to resolve conflict Created 6 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/test/data/chromeos/wallpaper_manager/unit_tests/api_mock.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 var WallpaperUtil = { 5 var WallpaperUtil = {
6 strings: null, // Object that contains all the flags 6 strings: null, // Object that contains all the flags
7 syncFs: null, // syncFileSystem handler 7 syncFs: null, // syncFileSystem handler
8 webkitFs: null // webkitFileSystem handler 8 webkitFs: null // webkitFileSystem handler
9 }; 9 };
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 /** 47 /**
48 * Loads a wallpaper from sync file system and saves it and its thumbnail to 48 * Loads a wallpaper from sync file system and saves it and its thumbnail to
49 * local file system. 49 * local file system.
50 * @param {string} wallpaperFileEntry File name of wallpaper image. 50 * @param {string} wallpaperFileEntry File name of wallpaper image.
51 */ 51 */
52 WallpaperUtil.storeWallpaperFromSyncFSToLocalFS = function(wallpaperFileEntry) { 52 WallpaperUtil.storeWallpaperFromSyncFSToLocalFS = function(wallpaperFileEntry) {
53 var filenName = wallpaperFileEntry.name; 53 var filenName = wallpaperFileEntry.name;
54 var storeDir = Constants.WallpaperDirNameEnum.ORIGINAL; 54 var storeDir = Constants.WallpaperDirNameEnum.ORIGINAL;
55 if (filenName.indexOf(Constants.CustomWallpaperThumbnailSuffix) != -1) 55 if (filenName.indexOf(Constants.CustomWallpaperThumbnailSuffix) != -1)
56 storeDir = Constants.WallpaperDirNameEnum.THUMBNAIL; 56 storeDir = Constants.WallpaperDirNameEnum.THUMBNAIL;
57 filenName = filenName.replace(Constants.CustomWallpaperThumbnailSuffix, '');
57 wallpaperFileEntry.file(function(file) { 58 wallpaperFileEntry.file(function(file) {
58 var reader = new FileReader(); 59 var reader = new FileReader();
59 reader.onloadend = function() { 60 reader.onloadend = function() {
60 WallpaperUtil.storeWallpaperToLocalFS(filenName, reader.result, storeDir); 61 WallpaperUtil.storeWallpaperToLocalFS(filenName, reader.result, storeDir);
61 }; 62 };
62 reader.readAsArrayBuffer(file); 63 reader.readAsArrayBuffer(file);
63 }, WallpaperUtil.onFileSystemError); 64 }, WallpaperUtil.onFileSystemError);
64 }; 65 };
65 66
66 /** 67 /**
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 * Runs chrome.test.sendMessage in test environment. Does nothing if running 385 * Runs chrome.test.sendMessage in test environment. Does nothing if running
385 * in production environment. 386 * in production environment.
386 * 387 *
387 * @param {string} message Test message to send. 388 * @param {string} message Test message to send.
388 */ 389 */
389 WallpaperUtil.testSendMessage = function(message) { 390 WallpaperUtil.testSendMessage = function(message) {
390 var test = chrome.test || window.top.chrome.test; 391 var test = chrome.test || window.top.chrome.test;
391 if (test) 392 if (test)
392 test.sendMessage(message); 393 test.sendMessage(message);
393 }; 394 };
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/chromeos/wallpaper_manager/unit_tests/api_mock.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698