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/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "chrome/browser/drive/fake_drive_service.h" | 9 #include "chrome/browser/drive/fake_drive_service.h" |
10 #include "content/public/test/test_browser_thread_bundle.h" | 10 #include "content/public/test/test_browser_thread_bundle.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 std::vector<DriveAppInfo> apps; | 144 std::vector<DriveAppInfo> apps; |
145 apps_registry_->GetAppList(&apps); | 145 apps_registry_->GetAppList(&apps); |
146 size_t original_count = apps.size(); | 146 size_t original_count = apps.size(); |
147 | 147 |
148 // Uninstall an existing app. | 148 // Uninstall an existing app. |
149 google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR; | 149 google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR; |
150 apps_registry_->UninstallApp( | 150 apps_registry_->UninstallApp( |
151 "123456788192", | 151 "123456788192", |
152 google_apis::test_util::CreateCopyResultCallback(&error)); | 152 google_apis::test_util::CreateCopyResultCallback(&error)); |
153 base::RunLoop().RunUntilIdle(); | 153 base::RunLoop().RunUntilIdle(); |
154 EXPECT_EQ(error, google_apis::HTTP_SUCCESS); | 154 EXPECT_EQ(error, google_apis::HTTP_NO_CONTENT); |
155 | 155 |
156 // Check that the number of apps is decreased by one. | 156 // Check that the number of apps is decreased by one. |
157 apps_registry_->GetAppList(&apps); | 157 apps_registry_->GetAppList(&apps); |
158 EXPECT_EQ(original_count - 1, apps.size()); | 158 EXPECT_EQ(original_count - 1, apps.size()); |
159 | 159 |
160 // Try to uninstall a non-existing app. | 160 // Try to uninstall a non-existing app. |
161 error = google_apis::GDATA_OTHER_ERROR; | 161 error = google_apis::GDATA_OTHER_ERROR; |
162 apps_registry_->UninstallApp( | 162 apps_registry_->UninstallApp( |
163 "non-existing-app-id", | 163 "non-existing-app-id", |
164 google_apis::test_util::CreateCopyResultCallback(&error)); | 164 google_apis::test_util::CreateCopyResultCallback(&error)); |
165 base::RunLoop().RunUntilIdle(); | 165 base::RunLoop().RunUntilIdle(); |
166 EXPECT_EQ(error, google_apis::HTTP_NOT_FOUND); | 166 EXPECT_EQ(error, google_apis::HTTP_NOT_FOUND); |
167 | 167 |
168 // Check that the number is not changed this time. | 168 // Check that the number is not changed this time. |
169 apps_registry_->GetAppList(&apps); | 169 apps_registry_->GetAppList(&apps); |
170 EXPECT_EQ(original_count - 1, apps.size()); | 170 EXPECT_EQ(original_count - 1, apps.size()); |
171 } | 171 } |
172 | 172 |
173 } // namespace drive | 173 } // namespace drive |
OLD | NEW |