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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 // The requested size is smaller than the smallest icon. The smallest icon | 130 // The requested size is smaller than the smallest icon. The smallest icon |
131 // should be returned. | 131 // should be returned. |
132 EXPECT_EQ(kSmallerIconUrl, | 132 EXPECT_EQ(kSmallerIconUrl, |
133 util::FindPreferredIcon(icons, kMediumSize - 3).spec()); | 133 util::FindPreferredIcon(icons, kMediumSize - 3).spec()); |
134 // The requested size is larger than the largest icon. The largest icon | 134 // The requested size is larger than the largest icon. The largest icon |
135 // should be returned. | 135 // should be returned. |
136 EXPECT_EQ(kBiggerIconUrl, | 136 EXPECT_EQ(kBiggerIconUrl, |
137 util::FindPreferredIcon(icons, kMediumSize + 3).spec()); | 137 util::FindPreferredIcon(icons, kMediumSize + 3).spec()); |
138 } | 138 } |
139 | 139 |
140 TEST_F(DriveAppRegistryTest, UninstallDriveApp) { | |
141 apps_registry_->Update(); | |
142 base::RunLoop().RunUntilIdle(); | |
143 | |
144 std::vector<DriveAppInfo> apps; | |
145 apps_registry_->GetAppList(&apps); | |
146 size_t original_count = apps.size(); | |
147 | |
148 // Uninstall an existing app. | |
149 google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR; | |
150 apps_registry_->UninstallApp( | |
151 "123456788192", | |
152 google_apis::test_util::CreateCopyResultCallback(&error)); | |
153 base::RunLoop().RunUntilIdle(); | |
154 EXPECT_EQ(error, google_apis::HTTP_SUCCESS); | |
155 | |
156 // Check that the number of apps is decreased by one. | |
157 apps_registry_->GetAppList(&apps); | |
158 EXPECT_EQ(original_count - 1, apps.size()); | |
159 | |
160 // Try to uninstall a non-existing app. | |
161 error = google_apis::GDATA_OTHER_ERROR; | |
162 apps_registry_->UninstallApp( | |
163 "non-existing-app-id", | |
164 google_apis::test_util::CreateCopyResultCallback(&error)); | |
165 base::RunLoop().RunUntilIdle(); | |
166 EXPECT_EQ(error, google_apis::HTTP_NOT_FOUND); | |
167 | |
168 // Check that the number is not changed this time. | |
169 apps_registry_->GetAppList(&apps); | |
170 EXPECT_EQ(original_count - 1, apps.size()); | |
171 } | |
172 | |
173 } // namespace drive | 140 } // namespace drive |
OLD | NEW |