Index: chrome/browser/chromeos/drive/drive_scheduler_unittest.cc |
diff --git a/chrome/browser/chromeos/drive/drive_scheduler_unittest.cc b/chrome/browser/chromeos/drive/drive_scheduler_unittest.cc |
index e4806076571431709815c730e96f99877de12a78..b12096e90b0786402a8d5d9cf2a06df16fdd92b2 100644 |
--- a/chrome/browser/chromeos/drive/drive_scheduler_unittest.cc |
+++ b/chrome/browser/chromeos/drive/drive_scheduler_unittest.cc |
@@ -11,6 +11,7 @@ |
#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/mock_drive_service.h" |
#include "chrome/browser/prefs/pref_service.h" |
#include "chrome/common/pref_names.h" |
#include "chrome/test/base/testing_profile.h" |
@@ -20,6 +21,7 @@ |
using ::testing::AnyNumber; |
using ::testing::DoAll; |
+using ::testing::Eq; |
using ::testing::Return; |
using ::testing::StrictMock; |
using ::testing::_; |
@@ -100,6 +102,10 @@ class DriveSchedulerTest : public testing::Test { |
virtual void SetUp() OVERRIDE { |
mock_network_change_notifier_.reset(new MockNetworkChangeNotifier); |
+ // Allocate and keep a pointer to the mock, and inject it into the |
+ // DriveFileSystem object, which will own the mock object. |
kinaba
2012/11/22 08:04:07
IIUC, DriveFileSystem does not own DriveService (t
Zachary Kuznia
2012/11/28 06:54:56
Removed the comment.
|
+ mock_drive_service_ = new StrictMock<google_apis::MockDriveService>; |
kinaba
2012/11/22 08:04:07
Satorux is deprecating MockDriveService http://crb
|
+ |
mock_copy_operation_ = new StrictMock<MockCopyOperation>(); |
mock_move_operation_ = new StrictMock<MockMoveOperation>(); |
mock_remove_operation_ = new StrictMock<MockRemoveOperation>(); |
@@ -108,6 +114,7 @@ class DriveSchedulerTest : public testing::Test { |
mock_remove_operation_, |
NULL); |
scheduler_.reset(new DriveScheduler(profile_.get(), |
+ mock_drive_service_, |
&drive_operations_)); |
scheduler_->Initialize(); |
@@ -119,6 +126,8 @@ class DriveSchedulerTest : public testing::Test { |
// registers itself as observer of NetworkLibrary. |
scheduler_.reset(); |
google_apis::test_util::RunBlockingPoolTask(); |
+ delete mock_drive_service_; |
+ mock_drive_service_ = NULL; |
mock_network_change_notifier_.reset(); |
} |
@@ -159,6 +168,7 @@ class DriveSchedulerTest : public testing::Test { |
scoped_ptr<TestingProfile> profile_; |
scoped_ptr<DriveScheduler> scheduler_; |
scoped_ptr<MockNetworkChangeNotifier> mock_network_change_notifier_; |
+ StrictMock<google_apis::MockDriveService>* mock_drive_service_; |
file_system::DriveOperations drive_operations_; |
StrictMock<MockCopyOperation>* mock_copy_operation_; |
@@ -237,6 +247,25 @@ TEST_F(DriveSchedulerTest, TransferRegularFileFile) { |
ASSERT_EQ(DRIVE_FILE_OK, error); |
} |
+TEST_F(DriveSchedulerTest, GetDocuments) { |
+ 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_drive_service_, |
+ GetDocuments(Eq(GURL()), _, _, _, _, _)).Times(1); |
+ |
+ |
+ scheduler_->GetDocuments( |
+ GURL(), |
+ 0, |
+ std::string(), |
+ true, |
+ std::string(), |
+ google_apis::GetDataCallback()); |
+ google_apis::test_util::RunBlockingPoolTask(); |
satorux1
2012/11/22 08:12:45
I think we should check the results we get by GetD
Zachary Kuznia
2012/11/28 06:54:56
Done.
|
+} |
+ |
TEST_F(DriveSchedulerTest, MoveFile) { |
ConnectToWifi(); |