| 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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
| 6 #include "chrome/browser/ui/app_list/app_list_prefs.h" | 6 #include "chrome/browser/ui/app_list/app_list_prefs.h" |
| 7 #include "chrome/browser/ui/app_list/extension_app_item.h" | 7 #include "chrome/browser/ui/app_list/extension_app_item.h" |
| 8 #include "chrome/browser/ui/app_list/model_pref_updater.h" | 8 #include "chrome/browser/ui/app_list/model_pref_updater.h" |
| 9 #include "components/pref_registry/testing_pref_service_syncable.h" | 9 #include "components/pref_registry/testing_pref_service_syncable.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 #include "ui/app_list/app_list_folder_item.h" | 11 #include "ui/app_list/app_list_folder_item.h" |
| 12 #include "ui/app_list/app_list_item.h" | 12 #include "ui/app_list/app_list_item.h" |
| 13 #include "ui/app_list/test/app_list_test_model.h" | 13 #include "ui/app_list/test/app_list_test_model.h" |
| 14 | 14 |
| 15 namespace app_list { | 15 namespace app_list { |
| 16 namespace test { | 16 namespace test { |
| 17 | 17 |
| 18 class TestExtensionAppItem : public AppListItem { | 18 class TestExtensionAppItem : public AppListItem { |
| 19 public: | 19 public: |
| 20 explicit TestExtensionAppItem(const std::string& id) : AppListItem(id) {} | 20 explicit TestExtensionAppItem(const std::string& id) : AppListItem(id) {} |
| 21 virtual ~TestExtensionAppItem() {} | 21 virtual ~TestExtensionAppItem() {} |
| 22 | 22 |
| 23 virtual const char* GetItemType() const OVERRIDE { | 23 virtual const char* GetItemType() const override { |
| 24 return ExtensionAppItem::kItemType; | 24 return ExtensionAppItem::kItemType; |
| 25 } | 25 } |
| 26 | 26 |
| 27 private: | 27 private: |
| 28 DISALLOW_COPY_AND_ASSIGN(TestExtensionAppItem); | 28 DISALLOW_COPY_AND_ASSIGN(TestExtensionAppItem); |
| 29 }; | 29 }; |
| 30 | 30 |
| 31 class ModelPrefUpdaterTest : public testing::Test { | 31 class ModelPrefUpdaterTest : public testing::Test { |
| 32 public: | 32 public: |
| 33 ModelPrefUpdaterTest() {} | 33 ModelPrefUpdaterTest() {} |
| 34 virtual ~ModelPrefUpdaterTest() {} | 34 virtual ~ModelPrefUpdaterTest() {} |
| 35 | 35 |
| 36 virtual void SetUp() OVERRIDE { | 36 virtual void SetUp() override { |
| 37 AppListPrefs::RegisterProfilePrefs(pref_service_.registry()); | 37 AppListPrefs::RegisterProfilePrefs(pref_service_.registry()); |
| 38 prefs_.reset(AppListPrefs::Create(&pref_service_)); | 38 prefs_.reset(AppListPrefs::Create(&pref_service_)); |
| 39 model_.reset(new AppListTestModel()); | 39 model_.reset(new AppListTestModel()); |
| 40 pref_updater_.reset(new ModelPrefUpdater(prefs_.get(), model_.get())); | 40 pref_updater_.reset(new ModelPrefUpdater(prefs_.get(), model_.get())); |
| 41 } | 41 } |
| 42 | 42 |
| 43 AppListTestModel* model() { return model_.get(); } | 43 AppListTestModel* model() { return model_.get(); } |
| 44 | 44 |
| 45 AppListPrefs* prefs() { return prefs_.get(); } | 45 AppListPrefs* prefs() { return prefs_.get(); } |
| 46 | 46 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 EXPECT_EQ(folder->id(), item->folder_id()); | 93 EXPECT_EQ(folder->id(), item->folder_id()); |
| 94 | 94 |
| 95 prefs()->GetAllAppListInfos(&infos); | 95 prefs()->GetAllAppListInfos(&infos); |
| 96 EXPECT_EQ(2u, infos.size()); | 96 EXPECT_EQ(2u, infos.size()); |
| 97 EXPECT_TRUE(AppListItemMatchesPrefs(folder)); | 97 EXPECT_TRUE(AppListItemMatchesPrefs(folder)); |
| 98 EXPECT_TRUE(AppListItemMatchesPrefs(item)); | 98 EXPECT_TRUE(AppListItemMatchesPrefs(item)); |
| 99 } | 99 } |
| 100 | 100 |
| 101 } // namespace test | 101 } // namespace test |
| 102 } // namespace app_list | 102 } // namespace app_list |
| OLD | NEW |