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

Side by Side Diff: ui/file_manager/gallery/js/gallery_data_model_unittest.js

Issue 838993002: Gallery: Split GalleryDataModel from gallery.js. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix the year. Created 5 years, 11 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 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
6 var model;
7 var fileSystem;
8 var item;
9
10 function setUp() {
11 var metadataCache = new MockMetadataCache();
12 model = new GalleryDataModel(metadataCache, /* Mock EntryListWatcher */{});
13 fileSystem = new MockFileSystem('volumeId');
14 item = new Gallery.Item(
15 new MockEntry(fileSystem, '/test.jpg'),
16 null,
17 {media: {mimeType: 'image/jpeg'}},
18 metadataCache,
19 /* original */ true);
20 }
21
22 function testSaveItemOverwrite(callback) {
23 // Mocking the saveToFile method.
24 item.saveToFile = function(
25 volumeManager,
26 fallbackDir,
27 overwrite,
28 canvas,
29 callback) {
30 assertTrue(overwrite);
31 callback(true);
32 };
33 model.push(item);
34 reportPromise(
35 model.saveItem({}, item, document.createElement('canvas'), true).
36 then(function() { assertEquals(1, model.length); }),
37 callback);
38 }
39
40 function testSaveItemNewFile(callback) {
41 // Mocking the saveToFile method.
42 item.saveToFile = function(
43 volumeManager,
44 fallbackDir,
45 overwrite,
46 canvas,
47 callback) {
48 assertFalse(overwrite);
49 // Gallery item track new file.
50 this.entry_ = new MockEntry(fileSystem, '/test (1).jpg');
51 callback(true);
52 };
53 model.push(item);
54 reportPromise(
55 model.saveItem({}, item, document.createElement('canvas'), false).
56 then(function() { assertEquals(2, model.length); }),
57 callback);
58 }
OLDNEW
« no previous file with comments | « ui/file_manager/gallery/js/gallery_data_model_unittest.html ('k') | ui/file_manager/gallery/js/gallery_scripts.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698