| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/drive/drive_app_registry.h" | 5 #include "chrome/browser/drive/drive_app_registry.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 | 190 |
| 191 TEST_F(DriveAppRegistryTest, UninstallDriveApp) { | 191 TEST_F(DriveAppRegistryTest, UninstallDriveApp) { |
| 192 apps_registry_->Update(); | 192 apps_registry_->Update(); |
| 193 base::RunLoop().RunUntilIdle(); | 193 base::RunLoop().RunUntilIdle(); |
| 194 | 194 |
| 195 std::vector<DriveAppInfo> apps; | 195 std::vector<DriveAppInfo> apps; |
| 196 apps_registry_->GetAppList(&apps); | 196 apps_registry_->GetAppList(&apps); |
| 197 size_t original_count = apps.size(); | 197 size_t original_count = apps.size(); |
| 198 | 198 |
| 199 // Uninstall an existing app. | 199 // Uninstall an existing app. |
| 200 google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR; | 200 google_apis::DriveApiErrorCode error = google_apis::DRIVE_OTHER_ERROR; |
| 201 apps_registry_->UninstallApp( | 201 apps_registry_->UninstallApp( |
| 202 "123456788192", | 202 "123456788192", |
| 203 google_apis::test_util::CreateCopyResultCallback(&error)); | 203 google_apis::test_util::CreateCopyResultCallback(&error)); |
| 204 base::RunLoop().RunUntilIdle(); | 204 base::RunLoop().RunUntilIdle(); |
| 205 EXPECT_EQ(error, google_apis::HTTP_NO_CONTENT); | 205 EXPECT_EQ(error, google_apis::HTTP_NO_CONTENT); |
| 206 | 206 |
| 207 // Check that the number of apps is decreased by one. | 207 // Check that the number of apps is decreased by one. |
| 208 apps_registry_->GetAppList(&apps); | 208 apps_registry_->GetAppList(&apps); |
| 209 EXPECT_EQ(original_count - 1, apps.size()); | 209 EXPECT_EQ(original_count - 1, apps.size()); |
| 210 | 210 |
| 211 // Try to uninstall a non-existing app. | 211 // Try to uninstall a non-existing app. |
| 212 error = google_apis::GDATA_OTHER_ERROR; | 212 error = google_apis::DRIVE_OTHER_ERROR; |
| 213 apps_registry_->UninstallApp( | 213 apps_registry_->UninstallApp( |
| 214 "non-existing-app-id", | 214 "non-existing-app-id", |
| 215 google_apis::test_util::CreateCopyResultCallback(&error)); | 215 google_apis::test_util::CreateCopyResultCallback(&error)); |
| 216 base::RunLoop().RunUntilIdle(); | 216 base::RunLoop().RunUntilIdle(); |
| 217 EXPECT_EQ(error, google_apis::HTTP_NOT_FOUND); | 217 EXPECT_EQ(error, google_apis::HTTP_NOT_FOUND); |
| 218 | 218 |
| 219 // Check that the number is not changed this time. | 219 // Check that the number is not changed this time. |
| 220 apps_registry_->GetAppList(&apps); | 220 apps_registry_->GetAppList(&apps); |
| 221 EXPECT_EQ(original_count - 1, apps.size()); | 221 EXPECT_EQ(original_count - 1, apps.size()); |
| 222 } | 222 } |
| 223 | 223 |
| 224 } // namespace drive | 224 } // namespace drive |
| OLD | NEW |