OLD | NEW |
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 "chrome/browser/sync_file_system/drive_file_sync_client.h" | 5 #include "chrome/browser/sync_file_system/drive_file_sync_client.h" |
6 | 6 |
7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
10 #include "chrome/browser/google_apis/drive_uploader.h" | 10 #include "chrome/browser/google_apis/drive_uploader.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 DriveFileSyncClientTest() | 129 DriveFileSyncClientTest() |
130 : mock_drive_service_(NULL), | 130 : mock_drive_service_(NULL), |
131 fake_drive_uploader_(NULL) { | 131 fake_drive_uploader_(NULL) { |
132 } | 132 } |
133 | 133 |
134 virtual void SetUp() OVERRIDE { | 134 virtual void SetUp() OVERRIDE { |
135 mock_drive_service_ = new StrictMock<MockDriveService>; | 135 mock_drive_service_ = new StrictMock<MockDriveService>; |
136 fake_drive_uploader_ = new FakeDriveUploader; | 136 fake_drive_uploader_ = new FakeDriveUploader; |
137 | 137 |
138 EXPECT_CALL(*mock_drive_service_, Initialize(&profile_)).Times(1); | 138 EXPECT_CALL(*mock_drive_service_, Initialize(&profile_)).Times(1); |
| 139 EXPECT_CALL(*mock_drive_service_, AddObserver(_)); |
139 | 140 |
140 sync_client_ = DriveFileSyncClient::CreateForTesting( | 141 sync_client_ = DriveFileSyncClient::CreateForTesting( |
141 &profile_, | 142 &profile_, |
142 scoped_ptr<DriveServiceInterface>(mock_drive_service_), | 143 scoped_ptr<DriveServiceInterface>(mock_drive_service_), |
143 scoped_ptr<DriveUploaderInterface>(fake_drive_uploader_)).Pass(); | 144 scoped_ptr<DriveUploaderInterface>(fake_drive_uploader_)).Pass(); |
144 } | 145 } |
145 | 146 |
146 virtual void TearDown() OVERRIDE { | 147 virtual void TearDown() OVERRIDE { |
| 148 EXPECT_CALL(*mock_drive_service_, RemoveObserver(_)); |
147 EXPECT_CALL(*mock_drive_service(), CancelAll()); | 149 EXPECT_CALL(*mock_drive_service(), CancelAll()); |
148 sync_client_.reset(); | 150 sync_client_.reset(); |
149 } | 151 } |
150 | 152 |
151 protected: | 153 protected: |
152 DriveFileSyncClient* sync_client() { return sync_client_.get(); } | 154 DriveFileSyncClient* sync_client() { return sync_client_.get(); } |
153 | 155 |
154 std::string FormatOriginQuery(const GURL& origin) { | 156 std::string FormatOriginQuery(const GURL& origin) { |
155 return FormatTitleQuery( | 157 return FormatTitleQuery( |
156 DriveFileSyncClient::OriginToDirectoryTitle(origin)); | 158 DriveFileSyncClient::OriginToDirectoryTitle(origin)); |
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
844 base::Bind(&DidDeleteFile, &done, &error)); | 846 base::Bind(&DidDeleteFile, &done, &error)); |
845 message_loop()->RunUntilIdle(); | 847 message_loop()->RunUntilIdle(); |
846 | 848 |
847 EXPECT_TRUE(done); | 849 EXPECT_TRUE(done); |
848 EXPECT_EQ(google_apis::HTTP_CONFLICT, error); | 850 EXPECT_EQ(google_apis::HTTP_CONFLICT, error); |
849 } | 851 } |
850 | 852 |
851 #endif // !defined(OS_ANDROID) | 853 #endif // !defined(OS_ANDROID) |
852 | 854 |
853 } // namespace sync_file_system | 855 } // namespace sync_file_system |
OLD | NEW |