1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
|
// 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.
#include "chrome/browser/chromeos/drive/drive_scheduler.h"
#include "base/bind.h"
#include "base/file_util.h"
#include "base/json/json_reader.h"
#include "base/threading/sequenced_worker_pool.h"
#include "chrome/browser/chromeos/drive/drive_test_util.h"
#include "chrome/browser/chromeos/drive/file_system/drive_operations.h"
#include "chrome/browser/chromeos/drive/file_system/copy_operation.h"
#include "chrome/browser/chromeos/drive/file_system/move_operation.h"
#include "chrome/browser/chromeos/drive/file_system/remove_operation.h"
#include "chrome/browser/google_apis/gdata_wapi_parser.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/testing_profile.h"
#include "content/public/test/test_browser_thread.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
using ::testing::AnyNumber;
using ::testing::DoAll;
using ::testing::Eq;
using ::testing::Return;
using ::testing::StrictMock;
using ::testing::_;
namespace google_apis {
class FakeDriveService : public DriveServiceInterface {
virtual void Initialize(Profile* profile) {
}
virtual void AddObserver(DriveServiceObserver* observer) {
}
virtual void RemoveObserver(DriveServiceObserver* observer) {
}
virtual bool CanStartOperation() const {
return true;
}
virtual void CancelAll() {
}
virtual bool CancelForFilePath(const FilePath& file_path) {
return true;
}
virtual OperationProgressStatusList GetProgressStatusList() const {
return OperationProgressStatusList();
}
virtual bool HasAccessToken() const {
return true;
}
virtual bool HasRefreshToken() const {
return true;
}
virtual void GetResourceList(const GURL& feed_url,
int64 start_changestamp,
const std::string& search_query,
bool shared_with_me,
const std::string& directory_resource_id,
const GetResourceListCallback& callback) {
// TODO: Make this more flexible.
if (feed_url == GURL("http://example.com/gdata/root_feed.json")) {
// Make some sample data.
scoped_ptr<base::Value> feed_data = google_apis::test_util::LoadJSONFile(
"gdata/root_feed.json");
scoped_ptr<google_apis::ResourceList> resource_list =
google_apis::ResourceList::ExtractAndParse(*feed_data);
base::MessageLoopProxy::current()->PostTask(FROM_HERE,
base::Bind(callback,
HTTP_SUCCESS,
base::Passed(&resource_list)));
} else {
scoped_ptr<google_apis::ResourceList> resource_list;
base::MessageLoopProxy::current()->PostTask(FROM_HERE,
base::Bind(callback,
GDATA_PARSE_ERROR,
base::Passed(&resource_list)));
}
}
virtual void GetResourceEntry(const std::string& resource_id,
const GetResourceEntryCallback& callback) {
}
virtual void GetAccountMetadata(const GetAccountMetadataCallback& callback) {
// Make some sample data.
scoped_ptr<Value> data = google_apis::test_util::LoadJSONFile(
"gdata/account_metadata.json");
scoped_ptr<google_apis::AccountMetadataFeed> account_metadata
= google_apis::AccountMetadataFeed::CreateFrom(*data);
base::MessageLoopProxy::current()->PostTask(FROM_HERE,
base::Bind(callback,
HTTP_SUCCESS,
base::Passed(&account_metadata)));
}
virtual void GetApplicationInfo(const GetDataCallback& callback) {
scoped_ptr<Value> data = google_apis::test_util::LoadJSONFile(
"gdata/account_metadata.json");
base::MessageLoopProxy::current()->PostTask(FROM_HERE,
base::Bind(callback,
HTTP_SUCCESS,
base::Passed(&data)));
}
virtual void DeleteResource(const GURL& edit_url,
const EntryActionCallback& callback) {
}
virtual void DownloadHostedDocument(const FilePath& virtual_path,
const FilePath& local_cache_path,
const GURL& content_url,
DocumentExportFormat format,
const DownloadActionCallback& callback) {
}
virtual void CopyHostedDocument(const std::string& resource_id,
const FilePath::StringType& new_name,
const GetResourceEntryCallback& callback) {
}
virtual void RenameResource(const GURL& edit_url,
const FilePath::StringType& new_name,
const EntryActionCallback& callback) {
}
virtual void AddResourceToDirectory(const GURL& parent_content_url,
const GURL& edit_url,
const EntryActionCallback& callback) {
}
virtual void RemoveResourceFromDirectory(
const GURL& parent_content_url,
const std::string& resource_id,
const EntryActionCallback& callback) {
}
virtual void AddNewDirectory(const GURL& parent_content_url,
const FilePath::StringType& directory_name,
const GetDataCallback& callback) {
}
virtual void DownloadFile(
const FilePath& virtual_path,
const FilePath& local_cache_path,
const GURL& content_url,
const DownloadActionCallback& download_action_callback,
const GetContentCallback& get_content_callback) {
}
virtual void InitiateUpload(const InitiateUploadParams& params,
const InitiateUploadCallback& callback) {
}
virtual void ResumeUpload(const ResumeUploadParams& params,
const ResumeUploadCallback& callback) {
}
virtual void AuthorizeApp(const GURL& edit_url,
const std::string& app_id,
const AuthorizeAppCallback& callback) {
}
};
} // namespace google_apis
namespace drive {
namespace {
class MockNetworkChangeNotifier : public net::NetworkChangeNotifier {
public:
MOCK_CONST_METHOD0(GetCurrentConnectionType,
net::NetworkChangeNotifier::ConnectionType());
};
class MockCopyOperation : public file_system::CopyOperation {
public:
MockCopyOperation()
: file_system::CopyOperation(NULL, NULL, NULL, NULL, NULL, NULL) {
}
MOCK_METHOD3(Copy, void(const FilePath& src_file_path,
const FilePath& dest_file_path,
const FileOperationCallback& callback));
MOCK_METHOD3(TransferFileFromRemoteToLocal,
void(const FilePath& remote_src_file_path,
const FilePath& local_dest_file_path,
const FileOperationCallback& callback));
MOCK_METHOD3(TransferFileFromLocalToRemote,
void(const FilePath& local_src_file_path,
const FilePath& remote_dest_file_path,
const FileOperationCallback& callback));
MOCK_METHOD3(TransferRegularFile,
void(const FilePath& local_src_file_path,
const FilePath& remote_dest_file_path,
const FileOperationCallback& callback));
};
class MockMoveOperation : public file_system::MoveOperation {
public:
MockMoveOperation()
: file_system::MoveOperation(NULL, NULL, NULL) {
}
MOCK_METHOD3(Move, void(const FilePath& src_file_path,
const FilePath& dest_file_path,
const FileOperationCallback& callback));
};
class MockRemoveOperation : public file_system::RemoveOperation {
public:
MockRemoveOperation()
: file_system::RemoveOperation(NULL, NULL, NULL, NULL) {
}
MOCK_METHOD3(Remove, void(const FilePath& file_path,
bool is_recursive,
const FileOperationCallback& callback));
};
// Action used to set mock expectations,
ACTION_P(MockOperation, status) {
base::MessageLoopProxy::current()->PostTask(FROM_HERE,
base::Bind(arg2, status));
}
} // namespace
class DriveSchedulerTest : public testing::Test {
public:
DriveSchedulerTest()
: ui_thread_(content::BrowserThread::UI, &message_loop_),
profile_(new TestingProfile) {
}
virtual void SetUp() OVERRIDE {
mock_network_change_notifier_.reset(new MockNetworkChangeNotifier);
fake_drive_service_.reset(new google_apis::FakeDriveService());
mock_copy_operation_ = new StrictMock<MockCopyOperation>();
mock_move_operation_ = new StrictMock<MockMoveOperation>();
mock_remove_operation_ = new StrictMock<MockRemoveOperation>();
drive_operations_.InitForTesting(mock_copy_operation_,
mock_move_operation_,
mock_remove_operation_,
NULL);
scheduler_.reset(new DriveScheduler(profile_.get(),
fake_drive_service_.get(),
&drive_operations_));
scheduler_->Initialize();
scheduler_->SetDisableThrottling(true);
}
virtual void TearDown() OVERRIDE {
// The scheduler should be deleted before NetworkLibrary, as it
// registers itself as observer of NetworkLibrary.
scheduler_.reset();
google_apis::test_util::RunBlockingPoolTask();
fake_drive_service_.reset();
mock_network_change_notifier_.reset();
}
// Sets up MockNetworkChangeNotifier as if it's connected to a network with
// the specified connection type.
void ChangeConnectionType(net::NetworkChangeNotifier::ConnectionType type) {
EXPECT_CALL(*mock_network_change_notifier_, GetCurrentConnectionType())
.WillRepeatedly(Return(type));
// Notify the sync client that the network is changed. This is done via
// NetworkChangeNotifier in production, but here, we simulate the behavior
// by directly calling OnConnectionTypeChanged().
scheduler_->OnConnectionTypeChanged(type);
}
// Sets up MockNetworkChangeNotifier as if it's connected to wifi network.
void ConnectToWifi() {
ChangeConnectionType(net::NetworkChangeNotifier::CONNECTION_WIFI);
}
// Sets up MockNetworkChangeNotifier as if it's connected to cellular network.
void ConnectToCellular() {
ChangeConnectionType(net::NetworkChangeNotifier::CONNECTION_2G);
}
// Sets up MockNetworkChangeNotifier as if it's connected to wimax network.
void ConnectToWimax() {
ChangeConnectionType(net::NetworkChangeNotifier::CONNECTION_4G);
}
// Sets up MockNetworkChangeNotifier as if it's disconnected.
void ConnectToNone() {
ChangeConnectionType(net::NetworkChangeNotifier::CONNECTION_NONE);
}
protected:
MessageLoopForUI message_loop_;
content::TestBrowserThread ui_thread_;
scoped_ptr<TestingProfile> profile_;
scoped_ptr<DriveScheduler> scheduler_;
scoped_ptr<MockNetworkChangeNotifier> mock_network_change_notifier_;
scoped_ptr<google_apis::FakeDriveService> fake_drive_service_;
file_system::DriveOperations drive_operations_;
StrictMock<MockCopyOperation>* mock_copy_operation_;
StrictMock<MockMoveOperation>* mock_move_operation_;
StrictMock<MockRemoveOperation>* mock_remove_operation_;
};
TEST_F(DriveSchedulerTest, CopyFile) {
ConnectToWifi();
FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt"));
FilePath dest_file(FILE_PATH_LITERAL("drive/File 1.txt"));
EXPECT_CALL(*mock_copy_operation_, Copy(file_in_root, dest_file, _))
.WillOnce(MockOperation(DRIVE_FILE_OK));
DriveFileError error(DRIVE_FILE_ERROR_FAILED);
scheduler_->Copy(
file_in_root, dest_file,
base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback, &error));
google_apis::test_util::RunBlockingPoolTask();
ASSERT_EQ(DRIVE_FILE_OK, error);
}
TEST_F(DriveSchedulerTest, TransferFileFromRemoteToLocalFile) {
ConnectToWifi();
FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt"));
FilePath dest_file(FILE_PATH_LITERAL("drive/File 1.txt"));
EXPECT_CALL(*mock_copy_operation_,
TransferFileFromRemoteToLocal(file_in_root, dest_file, _))
.WillOnce(MockOperation(DRIVE_FILE_OK));
DriveFileError error(DRIVE_FILE_ERROR_FAILED);
scheduler_->TransferFileFromRemoteToLocal(
file_in_root, dest_file,
base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback, &error));
google_apis::test_util::RunBlockingPoolTask();
ASSERT_EQ(DRIVE_FILE_OK, error);
}
TEST_F(DriveSchedulerTest, TransferFileFromLocalToRemoteFile) {
ConnectToWifi();
FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt"));
FilePath dest_file(FILE_PATH_LITERAL("drive/File 1.txt"));
EXPECT_CALL(*mock_copy_operation_,
TransferFileFromLocalToRemote(file_in_root, dest_file, _))
.WillOnce(MockOperation(DRIVE_FILE_OK));
DriveFileError error(DRIVE_FILE_ERROR_FAILED);
scheduler_->TransferFileFromLocalToRemote(
file_in_root, dest_file,
base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback, &error));
google_apis::test_util::RunBlockingPoolTask();
ASSERT_EQ(DRIVE_FILE_OK, error);
}
TEST_F(DriveSchedulerTest, TransferRegularFileFile) {
ConnectToWifi();
FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt"));
FilePath dest_file(FILE_PATH_LITERAL("drive/File 1.txt"));
EXPECT_CALL(*mock_copy_operation_,
TransferRegularFile(file_in_root, dest_file, _))
.WillOnce(MockOperation(DRIVE_FILE_OK));
DriveFileError error(DRIVE_FILE_ERROR_FAILED);
scheduler_->TransferRegularFile(
file_in_root, dest_file,
base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback, &error));
google_apis::test_util::RunBlockingPoolTask();
ASSERT_EQ(DRIVE_FILE_OK, error);
}
TEST_F(DriveSchedulerTest, GetApplicationInfo) {
ConnectToWifi();
google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
scoped_ptr<base::Value> value;
scheduler_->GetApplicationInfo(
base::Bind(&google_apis::test_util::CopyResultsFromGetDataCallback,
&error,
&value));
google_apis::test_util::RunBlockingPoolTask();
ASSERT_EQ(google_apis::HTTP_SUCCESS, error);
ASSERT_TRUE(value);
}
TEST_F(DriveSchedulerTest, GetAccountMetadata) {
ConnectToWifi();
google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
scoped_ptr<google_apis::AccountMetadataFeed> account_metadata;
scheduler_->GetAccountMetadata(
base::Bind(
&google_apis::test_util::CopyResultsFromGetAccountMetadataCallback,
&error,
&account_metadata));
google_apis::test_util::RunBlockingPoolTask();
ASSERT_EQ(google_apis::HTTP_SUCCESS, error);
ASSERT_TRUE(account_metadata);
}
TEST_F(DriveSchedulerTest, GetResourceList) {
ConnectToWifi();
google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
scoped_ptr<google_apis::ResourceList> resource_list;
scheduler_->GetResourceList(
GURL("http://example.com/gdata/root_feed.json"),
0,
std::string(),
true,
std::string(),
base::Bind(
&google_apis::test_util::CopyResultsFromGetResourceListCallback,
&error,
&resource_list));
google_apis::test_util::RunBlockingPoolTask();
ASSERT_EQ(google_apis::HTTP_SUCCESS, error);
ASSERT_TRUE(resource_list);
}
TEST_F(DriveSchedulerTest, MoveFile) {
ConnectToWifi();
FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt"));
FilePath dest_file(FILE_PATH_LITERAL("drive/File 1.txt"));
EXPECT_CALL(*mock_move_operation_, Move(file_in_root, dest_file, _))
.WillOnce(MockOperation(DRIVE_FILE_OK));
DriveFileError error(DRIVE_FILE_ERROR_FAILED);
scheduler_->Move(
file_in_root, dest_file,
base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback, &error));
google_apis::test_util::RunBlockingPoolTask();
ASSERT_EQ(DRIVE_FILE_OK, error);
}
TEST_F(DriveSchedulerTest, MoveFileRetry) {
ConnectToWifi();
// This will fail once with a throttled message. It tests that the scheduler
// will retry in this case.
FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt"));
FilePath dest_file(FILE_PATH_LITERAL("drive/File 1.txt"));
EXPECT_CALL(*mock_move_operation_, Move(file_in_root, dest_file, _))
.WillOnce(MockOperation(DRIVE_FILE_ERROR_THROTTLED))
.WillOnce(MockOperation(DRIVE_FILE_OK));
DriveFileError error(DRIVE_FILE_ERROR_FAILED);
scheduler_->Move(
file_in_root, dest_file,
base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback, &error));
google_apis::test_util::RunBlockingPoolTask();
ASSERT_EQ(DRIVE_FILE_OK, error);
}
TEST_F(DriveSchedulerTest, RemoveFile) {
ConnectToWifi();
FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt"));
EXPECT_CALL(*mock_remove_operation_, Remove(file_in_root, _, _))
.WillOnce(MockOperation(DRIVE_FILE_OK));
DriveFileError error;
scheduler_->Remove(
file_in_root, false,
base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback, &error));
google_apis::test_util::RunBlockingPoolTask();
ASSERT_EQ(DRIVE_FILE_OK, error);
}
TEST_F(DriveSchedulerTest, RemoveFileRetry) {
ConnectToWifi();
// This will fail once with a throttled message. It tests that the scheduler
// will retry in this case.
FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt"));
EXPECT_CALL(*mock_remove_operation_, Remove(file_in_root, _, _))
.WillOnce(MockOperation(DRIVE_FILE_ERROR_THROTTLED))
.WillOnce(MockOperation(DRIVE_FILE_OK));
DriveFileError error;
scheduler_->Remove(
file_in_root, false,
base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback, &error));
google_apis::test_util::RunBlockingPoolTask();
ASSERT_EQ(DRIVE_FILE_OK, error);
}
TEST_F(DriveSchedulerTest, QueueOperation_Offline) {
ConnectToNone();
// This file will not be removed, as network is not connected.
EXPECT_CALL(*mock_remove_operation_, Remove(_, _, _)).Times(0);
FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt"));
DriveFileError error;
scheduler_->Remove(
file_in_root, false,
base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback, &error));
google_apis::test_util::RunBlockingPoolTask();
}
TEST_F(DriveSchedulerTest, QueueOperation_CelluarDisabled) {
ConnectToCellular();
// This file will not be removed, as fetching over cellular network is
// disabled by default.
EXPECT_CALL(*mock_remove_operation_, Remove(_, _, _)).Times(0);
FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt"));
DriveFileError error;
scheduler_->Remove(
file_in_root, false,
base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback, &error));
google_apis::test_util::RunBlockingPoolTask();
}
TEST_F(DriveSchedulerTest, QueueOperation_CelluarEnabled) {
// Enable fetching over cellular network.
profile_->GetPrefs()->SetBoolean(prefs::kDisableDriveOverCellular, false);
ConnectToCellular();
// This file will be removed, as syncing over cellular network is explicitly
// enabled.
EXPECT_CALL(*mock_remove_operation_, Remove(_, _, _)).Times(1);
FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt"));
DriveFileError error;
scheduler_->Remove(
file_in_root, false,
base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback, &error));
google_apis::test_util::RunBlockingPoolTask();
}
TEST_F(DriveSchedulerTest, QueueOperation_WimaxDisabled) {
// Then connect to wimax. This will kick off StartSyncLoop().
ConnectToWimax();
// This file will not be removed, as syncing over wimax network is disabled
// by default.
EXPECT_CALL(*mock_remove_operation_, Remove(_, _, _)).Times(0);
FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt"));
DriveFileError error;
scheduler_->Remove(
file_in_root, false,
base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback, &error));
google_apis::test_util::RunBlockingPoolTask();
}
TEST_F(DriveSchedulerTest, QueueOperation_CelluarEnabledWithWimax) {
// Enable fetching over cellular network.
profile_->GetPrefs()->SetBoolean(prefs::kDisableDriveOverCellular, false);
ConnectToWimax();
// This file will be removed, as syncing over cellular network is explicitly
// enabled.
EXPECT_CALL(*mock_remove_operation_, Remove(_, _, _)).Times(1);
FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt"));
DriveFileError error;
scheduler_->Remove(
file_in_root, false,
base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback, &error));
google_apis::test_util::RunBlockingPoolTask();
}
TEST_F(DriveSchedulerTest, QueueOperation_DriveDisabled) {
// Disable the Drive feature.
profile_->GetPrefs()->SetBoolean(prefs::kDisableDrive, true);
// This file will not be removed, as the Drive feature is disabled.
EXPECT_CALL(*mock_remove_operation_, Remove(_, _, _)).Times(0);
FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt"));
DriveFileError error;
scheduler_->Remove(
file_in_root, false,
base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback, &error));
google_apis::test_util::RunBlockingPoolTask();
}
} // namespace drive
|