Commit b2d560a6 authored by calvinlo@chromium.org's avatar calvinlo@chromium.org

Added JavaScript API Test for getFileSyncStatus() function.

BUG=163860


Review URL: https://chromiumcodereview.appspot.com/11663025

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175505 0039d316-1c4b-4281-b951-d872f2087c98
parent 85d81ab8
......@@ -12,14 +12,16 @@
#include "chrome/browser/sync_file_system/sync_file_system_service.h"
#include "chrome/common/chrome_version_info.h"
#include "chrome/common/extensions/features/feature.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "webkit/fileapi/syncable/sync_status_code.h"
#include "webkit/quota/quota_manager.h"
using ::testing::_;
using ::testing::Return;
using sync_file_system::MockRemoteFileSyncService;
using sync_file_system::RemoteFileSyncService;
using sync_file_system::SyncFileSystemServiceFactory;
using ::testing::_;
namespace chrome {
......@@ -77,6 +79,12 @@ IN_PROC_BROWSER_TEST_F(SyncFileSystemApiTest, DeleteFileSystem) {
<< message_;
}
IN_PROC_BROWSER_TEST_F(SyncFileSystemApiTest, GetFileSyncStatus) {
EXPECT_CALL(*mock_remote_service(), IsConflicting(_)).WillOnce(Return(true));
ASSERT_TRUE(RunPlatformAppTest("sync_file_system/get_file_sync_status"))
<< message_;
}
IN_PROC_BROWSER_TEST_F(SyncFileSystemApiTest, GetUsageAndQuota) {
ASSERT_TRUE(RunExtensionTest("sync_file_system/get_usage_and_quota"))
<< message_;
......
{
"name": "chrome.syncFileSystem.getFileSyncStatus",
"version": "0.1",
"manifest_version": 2,
"description": "end-to-end browser test for chrome.syncFileSystem.getFileSyncStatus API",
"permissions": ["syncFileSystem"],
"app": {
"background": {
"scripts": ["test.js"]
}
}
}
// Copyright (c) 2012 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.
var testStep = [
function() {
chrome.syncFileSystem.requestFileSystem('drive', testStep.shift());
},
// Create empty file.
function(fileSystem) {
fileSystem.root.getFile('Test.txt', {create: true}, testStep.shift(),
errorHandler);
},
// Confirm file is conflicting as this is the mocked value.
function(fileEntry) {
chrome.syncFileSystem.getFileSyncStatus(fileEntry, testStep.shift());
},
function(fileSyncStatus) {
chrome.test.assertEq("conflicting", fileSyncStatus);
chrome.test.succeed();
}
];
function errorHandler(e) {
console.log("Failed test with error" + e);
chrome.test.fail();
}
chrome.test.runTests([
testStep.shift()
]);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment