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/apps/drive/drive_app_mapping.h" | 5 #include "chrome/browser/apps/drive/drive_app_mapping.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "components/syncable_prefs/testing_pref_service_syncable.h" | 10 #include "components/sync_preferences/testing_pref_service_syncable.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 | 12 |
13 class DriveAppMappingTest : public testing::Test { | 13 class DriveAppMappingTest : public testing::Test { |
14 public: | 14 public: |
15 DriveAppMappingTest() {} | 15 DriveAppMappingTest() {} |
16 ~DriveAppMappingTest() override {} | 16 ~DriveAppMappingTest() override {} |
17 | 17 |
18 // testing::Test: | 18 // testing::Test: |
19 void SetUp() override { | 19 void SetUp() override { |
20 pref_service_.reset(new syncable_prefs::TestingPrefServiceSyncable); | 20 pref_service_.reset(new sync_preferences::TestingPrefServiceSyncable); |
21 DriveAppMapping::RegisterProfilePrefs(pref_service_->registry()); | 21 DriveAppMapping::RegisterProfilePrefs(pref_service_->registry()); |
22 | 22 |
23 mapping_.reset(new DriveAppMapping(pref_service_.get())); | 23 mapping_.reset(new DriveAppMapping(pref_service_.get())); |
24 } | 24 } |
25 | 25 |
26 DriveAppMapping* mapping() { return mapping_.get(); } | 26 DriveAppMapping* mapping() { return mapping_.get(); } |
27 | 27 |
28 private: | 28 private: |
29 std::unique_ptr<syncable_prefs::TestingPrefServiceSyncable> pref_service_; | 29 std::unique_ptr<sync_preferences::TestingPrefServiceSyncable> pref_service_; |
30 std::unique_ptr<DriveAppMapping> mapping_; | 30 std::unique_ptr<DriveAppMapping> mapping_; |
31 | 31 |
32 DISALLOW_COPY_AND_ASSIGN(DriveAppMappingTest); | 32 DISALLOW_COPY_AND_ASSIGN(DriveAppMappingTest); |
33 }; | 33 }; |
34 | 34 |
35 TEST_F(DriveAppMappingTest, Empty) { | 35 TEST_F(DriveAppMappingTest, Empty) { |
36 EXPECT_EQ("", mapping()->GetChromeApp("")); | 36 EXPECT_EQ("", mapping()->GetChromeApp("")); |
37 EXPECT_EQ("", mapping()->GetDriveApp("")); | 37 EXPECT_EQ("", mapping()->GetDriveApp("")); |
38 EXPECT_EQ("", mapping()->GetChromeApp("non-existent-drive-app")); | 38 EXPECT_EQ("", mapping()->GetChromeApp("non-existent-drive-app")); |
39 EXPECT_EQ("", mapping()->GetDriveApp("non-existent-chrome-app")); | 39 EXPECT_EQ("", mapping()->GetDriveApp("non-existent-chrome-app")); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 118 |
119 TEST_F(DriveAppMappingTest, TrackUninstall) { | 119 TEST_F(DriveAppMappingTest, TrackUninstall) { |
120 const std::string drive_app_id = "drive-1"; | 120 const std::string drive_app_id = "drive-1"; |
121 | 121 |
122 mapping()->AddUninstalledDriveApp(drive_app_id); | 122 mapping()->AddUninstalledDriveApp(drive_app_id); |
123 EXPECT_TRUE(mapping()->IsUninstalledDriveApp(drive_app_id)); | 123 EXPECT_TRUE(mapping()->IsUninstalledDriveApp(drive_app_id)); |
124 | 124 |
125 mapping()->RemoveUninstalledDriveApp(drive_app_id); | 125 mapping()->RemoveUninstalledDriveApp(drive_app_id); |
126 EXPECT_FALSE(mapping()->IsUninstalledDriveApp(drive_app_id)); | 126 EXPECT_FALSE(mapping()->IsUninstalledDriveApp(drive_app_id)); |
127 } | 127 } |
OLD | NEW |