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/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 registry_->AddObserver(this); | 26 registry_->AddObserver(this); |
27 } | 27 } |
28 virtual ~TestDriveAppRegistryObserver() { | 28 virtual ~TestDriveAppRegistryObserver() { |
29 registry_->RemoveObserver(this); | 29 registry_->RemoveObserver(this); |
30 } | 30 } |
31 | 31 |
32 int update_count() const { return update_count_; } | 32 int update_count() const { return update_count_; } |
33 | 33 |
34 private: | 34 private: |
35 // DriveAppRegistryObserver overrides: | 35 // DriveAppRegistryObserver overrides: |
36 virtual void OnDriveAppRegistryUpdated() OVERRIDE { ++update_count_; } | 36 virtual void OnDriveAppRegistryUpdated() override { ++update_count_; } |
37 | 37 |
38 DriveAppRegistry* registry_; | 38 DriveAppRegistry* registry_; |
39 int update_count_; | 39 int update_count_; |
40 DISALLOW_COPY_AND_ASSIGN(TestDriveAppRegistryObserver); | 40 DISALLOW_COPY_AND_ASSIGN(TestDriveAppRegistryObserver); |
41 }; | 41 }; |
42 | 42 |
43 class DriveAppRegistryTest : public testing::Test { | 43 class DriveAppRegistryTest : public testing::Test { |
44 protected: | 44 protected: |
45 virtual void SetUp() OVERRIDE { | 45 virtual void SetUp() override { |
46 fake_drive_service_.reset(new FakeDriveService); | 46 fake_drive_service_.reset(new FakeDriveService); |
47 fake_drive_service_->LoadAppListForDriveApi("drive/applist.json"); | 47 fake_drive_service_->LoadAppListForDriveApi("drive/applist.json"); |
48 | 48 |
49 apps_registry_.reset(new DriveAppRegistry(fake_drive_service_.get())); | 49 apps_registry_.reset(new DriveAppRegistry(fake_drive_service_.get())); |
50 } | 50 } |
51 | 51 |
52 bool VerifyApp(const std::vector<DriveAppInfo>& list, | 52 bool VerifyApp(const std::vector<DriveAppInfo>& list, |
53 const std::string& app_id, | 53 const std::string& app_id, |
54 const std::string& app_name) { | 54 const std::string& app_name) { |
55 bool found = false; | 55 bool found = false; |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 google_apis::test_util::CreateCopyResultCallback(&error)); | 218 google_apis::test_util::CreateCopyResultCallback(&error)); |
219 base::RunLoop().RunUntilIdle(); | 219 base::RunLoop().RunUntilIdle(); |
220 EXPECT_EQ(error, google_apis::HTTP_NOT_FOUND); | 220 EXPECT_EQ(error, google_apis::HTTP_NOT_FOUND); |
221 | 221 |
222 // Check that the number is not changed this time. | 222 // Check that the number is not changed this time. |
223 apps_registry_->GetAppList(&apps); | 223 apps_registry_->GetAppList(&apps); |
224 EXPECT_EQ(original_count - 1, apps.size()); | 224 EXPECT_EQ(original_count - 1, apps.size()); |
225 } | 225 } |
226 | 226 |
227 } // namespace drive | 227 } // namespace drive |
OLD | NEW |