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

Unified Diff: chrome/test/data/chromeos/wallpaper_manager/unit_tests/event_page_unittest.js

Issue 618743003: Unit test for sync online wallpaper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 6 years, 3 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: chrome/test/data/chromeos/wallpaper_manager/unit_tests/event_page_unittest.js
diff --git a/chrome/test/data/chromeos/wallpaper_manager/unit_tests/event_page_unittest.js b/chrome/test/data/chromeos/wallpaper_manager/unit_tests/event_page_unittest.js
new file mode 100644
index 0000000000000000000000000000000000000000..89031482b413bbda602edaa1ff3a747e636ba4f3
--- /dev/null
+++ b/chrome/test/data/chromeos/wallpaper_manager/unit_tests/event_page_unittest.js
@@ -0,0 +1,47 @@
+// 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.
+'use strict';
+
+var mockController;
+
+function setUp() {
+ mockController = new MockController();
+ installMockXMLHttpRequest();
+}
+
+function tearDown() {
+ mockController.verifyMocks();
+ mockController.reset();
+ uninstallMockXMLHttpRequest();
+}
+
+// Test sync online wallpaper. When the synced wallpaper info is not the same as
+// the local wallpaper info, wallpaper should set to the synced one.
+function testSyncOnlineWallpaper() {
+ // Setup sync value.
+ var changes = {};
+ changes[Constants.AccessSyncWallpaperInfoKey] = {};
+ changes[Constants.AccessSyncWallpaperInfoKey].newValue = {
+ 'url': TestConstants.wallpaperURL,
+ 'layout': 'custom',
+ 'source': Constants.WallpaperSourceEnum.Online
+ };
+
+ chrome.wallpaperPrivate = {};
+ var mockSetWallpaperIfExists = mockController.createFunctionMock(
+ chrome.wallpaperPrivate, 'setWallpaperIfExists');
+ mockSetWallpaperIfExists.addExpectation(
+ changes[Constants.AccessSyncWallpaperInfoKey].newValue.url,
+ changes[Constants.AccessSyncWallpaperInfoKey].newValue.layout);
+ mockSetWallpaperIfExists.callbackData = [false];
+
+ var mockSetWallpaper = mockController.createFunctionMock(
+ chrome.wallpaperPrivate, 'setWallpaper');
+ mockSetWallpaper.addExpectation(
+ TestConstants.image,
+ changes[Constants.AccessSyncWallpaperInfoKey].newValue.layout,
+ changes[Constants.AccessSyncWallpaperInfoKey].newValue.url);
+
+ chrome.storage.onChanged.dispatch(changes);
+}

Powered by Google App Engine
This is Rietveld 408576698