Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: chrome/browser/drive/drive_app_registry_unittest.cc

Issue 133123004: Implement DriveAppRegistry::UninstallApp() and GetAppList(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix after revert Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/drive/drive_app_registry.cc ('k') | chrome/browser/drive/fake_drive_service.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
140 } // namespace drive 173 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/drive/drive_app_registry.cc ('k') | chrome/browser/drive/fake_drive_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698