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 "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "chrome/test/base/testing_pref_service_syncable.h" | 9 #include "chrome/test/base/testing_pref_service_syncable.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 | 11 |
12 class DriveAppMappingTest : public testing::Test { | 12 class DriveAppMappingTest : public testing::Test { |
13 public: | 13 public: |
14 DriveAppMappingTest() {} | 14 DriveAppMappingTest() {} |
15 virtual ~DriveAppMappingTest() {} | 15 virtual ~DriveAppMappingTest() {} |
16 | 16 |
17 // testing::Test: | 17 // testing::Test: |
18 virtual void SetUp() OVERRIDE { | 18 virtual void SetUp() override { |
19 pref_service_.reset(new TestingPrefServiceSyncable); | 19 pref_service_.reset(new TestingPrefServiceSyncable); |
20 DriveAppMapping::RegisterProfilePrefs(pref_service_->registry()); | 20 DriveAppMapping::RegisterProfilePrefs(pref_service_->registry()); |
21 | 21 |
22 mapping_.reset(new DriveAppMapping(pref_service_.get())); | 22 mapping_.reset(new DriveAppMapping(pref_service_.get())); |
23 } | 23 } |
24 | 24 |
25 DriveAppMapping* mapping() { return mapping_.get(); } | 25 DriveAppMapping* mapping() { return mapping_.get(); } |
26 | 26 |
27 private: | 27 private: |
28 scoped_ptr<TestingPrefServiceSyncable> pref_service_; | 28 scoped_ptr<TestingPrefServiceSyncable> pref_service_; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 drive_app_ids = mapping()->GetDriveAppIds(); | 107 drive_app_ids = mapping()->GetDriveAppIds(); |
108 EXPECT_EQ(1u, drive_app_ids.size()); | 108 EXPECT_EQ(1u, drive_app_ids.size()); |
109 | 109 |
110 // Remove another one. | 110 // Remove another one. |
111 EXPECT_EQ("chrome-2", mapping()->GetChromeApp("drive-2")); | 111 EXPECT_EQ("chrome-2", mapping()->GetChromeApp("drive-2")); |
112 mapping()->Remove("drive-2"); | 112 mapping()->Remove("drive-2"); |
113 EXPECT_EQ("", mapping()->GetChromeApp("drive-2")); | 113 EXPECT_EQ("", mapping()->GetChromeApp("drive-2")); |
114 drive_app_ids = mapping()->GetDriveAppIds(); | 114 drive_app_ids = mapping()->GetDriveAppIds(); |
115 EXPECT_EQ(0u, drive_app_ids.size()); | 115 EXPECT_EQ(0u, drive_app_ids.size()); |
116 } | 116 } |
OLD | NEW |