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

Side by Side Diff: chrome/browser/extensions/api/sync_file_system/sync_file_system_apitest.cc

Issue 11663025: Added JavaScript API Test for getFileSyncStatus() function. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tzik review #1 Created 7 years, 12 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/test/data/extensions/api_test/sync_file_system/get_file_sync_status/manifest.json » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "base/file_util.h" 5 #include "base/file_util.h"
6 #include "base/path_service.h" 6 #include "base/path_service.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "chrome/browser/extensions/event_names.h" 8 #include "chrome/browser/extensions/event_names.h"
9 #include "chrome/browser/extensions/extension_apitest.h" 9 #include "chrome/browser/extensions/extension_apitest.h"
10 #include "chrome/browser/sync_file_system/local_change_processor.h" 10 #include "chrome/browser/sync_file_system/local_change_processor.h"
11 #include "chrome/browser/sync_file_system/mock_remote_file_sync_service.h" 11 #include "chrome/browser/sync_file_system/mock_remote_file_sync_service.h"
12 #include "chrome/browser/sync_file_system/sync_file_system_service.h" 12 #include "chrome/browser/sync_file_system/sync_file_system_service.h"
13 #include "chrome/common/chrome_version_info.h" 13 #include "chrome/common/chrome_version_info.h"
14 #include "chrome/common/extensions/features/feature.h" 14 #include "chrome/common/extensions/features/feature.h"
15 #include "testing/gmock/include/gmock/gmock.h"
15 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
16 #include "webkit/fileapi/syncable/sync_status_code.h" 17 #include "webkit/fileapi/syncable/sync_status_code.h"
17 #include "webkit/quota/quota_manager.h" 18 #include "webkit/quota/quota_manager.h"
18 19
20 using ::testing::_;
21 using ::testing::Return;
19 using sync_file_system::MockRemoteFileSyncService; 22 using sync_file_system::MockRemoteFileSyncService;
20 using sync_file_system::RemoteFileSyncService; 23 using sync_file_system::RemoteFileSyncService;
21 using sync_file_system::SyncFileSystemServiceFactory; 24 using sync_file_system::SyncFileSystemServiceFactory;
22 using ::testing::_;
23 25
24 namespace chrome { 26 namespace chrome {
25 27
26 namespace { 28 namespace {
27 29
28 class SyncFileSystemApiTest : public ExtensionApiTest { 30 class SyncFileSystemApiTest : public ExtensionApiTest {
29 public: 31 public:
30 // Override the current channel to "trunk" as syncFileSystem is currently 32 // Override the current channel to "trunk" as syncFileSystem is currently
31 // available only on trunk channel. 33 // available only on trunk channel.
32 SyncFileSystemApiTest() 34 SyncFileSystemApiTest()
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 72
71 // TODO(calvinlo): Add Chrome OS support for syncable file system 73 // TODO(calvinlo): Add Chrome OS support for syncable file system
72 // (http://crbug.com/160693) 74 // (http://crbug.com/160693)
73 #if !defined(OS_CHROMEOS) 75 #if !defined(OS_CHROMEOS)
74 76
75 IN_PROC_BROWSER_TEST_F(SyncFileSystemApiTest, DeleteFileSystem) { 77 IN_PROC_BROWSER_TEST_F(SyncFileSystemApiTest, DeleteFileSystem) {
76 ASSERT_TRUE(RunPlatformAppTest("sync_file_system/delete_file_system")) 78 ASSERT_TRUE(RunPlatformAppTest("sync_file_system/delete_file_system"))
77 << message_; 79 << message_;
78 } 80 }
79 81
82 IN_PROC_BROWSER_TEST_F(SyncFileSystemApiTest, GetFileSyncStatus) {
83 EXPECT_CALL(*mock_remote_service(), IsConflicting(_)).WillOnce(Return(true));
84 ASSERT_TRUE(RunPlatformAppTest("sync_file_system/get_file_sync_status"))
85 << message_;
86 }
87
80 IN_PROC_BROWSER_TEST_F(SyncFileSystemApiTest, GetUsageAndQuota) { 88 IN_PROC_BROWSER_TEST_F(SyncFileSystemApiTest, GetUsageAndQuota) {
81 ASSERT_TRUE(RunExtensionTest("sync_file_system/get_usage_and_quota")) 89 ASSERT_TRUE(RunExtensionTest("sync_file_system/get_usage_and_quota"))
82 << message_; 90 << message_;
83 } 91 }
84 92
85 IN_PROC_BROWSER_TEST_F(SyncFileSystemApiTest, OnSyncStateChanged) { 93 IN_PROC_BROWSER_TEST_F(SyncFileSystemApiTest, OnSyncStateChanged) {
86 EXPECT_CALL(*mock_remote_service(), 94 EXPECT_CALL(*mock_remote_service(),
87 RegisterOriginForTrackingChanges(_, _)) 95 RegisterOriginForTrackingChanges(_, _))
88 .WillOnce(NotifyOkStateAndCallback(mock_remote_service())); 96 .WillOnce(NotifyOkStateAndCallback(mock_remote_service()));
89 ASSERT_TRUE(RunPlatformAppTest("sync_file_system/on_sync_state_changed")) 97 ASSERT_TRUE(RunPlatformAppTest("sync_file_system/on_sync_state_changed"))
90 << message_; 98 << message_;
91 } 99 }
92 100
93 IN_PROC_BROWSER_TEST_F(SyncFileSystemApiTest, RequestFileSystem) { 101 IN_PROC_BROWSER_TEST_F(SyncFileSystemApiTest, RequestFileSystem) {
94 EXPECT_CALL(*mock_remote_service(), 102 EXPECT_CALL(*mock_remote_service(),
95 RegisterOriginForTrackingChanges(_, _)).Times(1); 103 RegisterOriginForTrackingChanges(_, _)).Times(1);
96 ASSERT_TRUE(RunPlatformAppTest("sync_file_system/request_file_system")) 104 ASSERT_TRUE(RunPlatformAppTest("sync_file_system/request_file_system"))
97 << message_; 105 << message_;
98 } 106 }
99 107
100 IN_PROC_BROWSER_TEST_F(SyncFileSystemApiTest, WriteFileThenGetUsage) { 108 IN_PROC_BROWSER_TEST_F(SyncFileSystemApiTest, WriteFileThenGetUsage) {
101 ASSERT_TRUE(RunPlatformAppTest("sync_file_system/write_file_then_get_usage")) 109 ASSERT_TRUE(RunPlatformAppTest("sync_file_system/write_file_then_get_usage"))
102 << message_; 110 << message_;
103 } 111 }
104 112
105 #endif // !defined(OS_CHROMEOS) 113 #endif // !defined(OS_CHROMEOS)
106 114
107 } // namespace chrome 115 } // namespace chrome
108 116
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/extensions/api_test/sync_file_system/get_file_sync_status/manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698