| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/prefs/pref_registry_simple.h" | 8 #include "base/prefs/pref_registry_simple.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/prefs/pref_service_factory.h" | 10 #include "base/prefs/pref_service_factory.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 int destroy_app_list_call_count() const { | 36 int destroy_app_list_call_count() const { |
| 37 return destroy_app_list_call_count_; | 37 return destroy_app_list_call_count_; |
| 38 } | 38 } |
| 39 | 39 |
| 40 void PerformStartupChecks(Profile* profile) { | 40 void PerformStartupChecks(Profile* profile) { |
| 41 AppListServiceImpl::PerformStartupChecks(profile); | 41 AppListServiceImpl::PerformStartupChecks(profile); |
| 42 } | 42 } |
| 43 | 43 |
| 44 // AppListService overrides: | 44 // AppListService overrides: |
| 45 virtual Profile* GetCurrentAppListProfile() OVERRIDE { | 45 virtual Profile* GetCurrentAppListProfile() override { |
| 46 // We don't return showing_for_profile_ here because that is only defined if | 46 // We don't return showing_for_profile_ here because that is only defined if |
| 47 // the app list is visible. | 47 // the app list is visible. |
| 48 return NULL; | 48 return NULL; |
| 49 } | 49 } |
| 50 | 50 |
| 51 virtual void CreateForProfile(Profile* requested_profile) OVERRIDE { | 51 virtual void CreateForProfile(Profile* requested_profile) override { |
| 52 } | 52 } |
| 53 | 53 |
| 54 virtual void ShowForProfile(Profile* requested_profile) OVERRIDE { | 54 virtual void ShowForProfile(Profile* requested_profile) override { |
| 55 showing_for_profile_ = requested_profile; | 55 showing_for_profile_ = requested_profile; |
| 56 RecordAppListLaunch(); | 56 RecordAppListLaunch(); |
| 57 } | 57 } |
| 58 | 58 |
| 59 virtual void DismissAppList() OVERRIDE { | 59 virtual void DismissAppList() override { |
| 60 showing_for_profile_ = NULL; | 60 showing_for_profile_ = NULL; |
| 61 } | 61 } |
| 62 | 62 |
| 63 virtual bool IsAppListVisible() const OVERRIDE { | 63 virtual bool IsAppListVisible() const override { |
| 64 return !!showing_for_profile_; | 64 return !!showing_for_profile_; |
| 65 } | 65 } |
| 66 | 66 |
| 67 virtual gfx::NativeWindow GetAppListWindow() OVERRIDE { | 67 virtual gfx::NativeWindow GetAppListWindow() override { |
| 68 return NULL; | 68 return NULL; |
| 69 } | 69 } |
| 70 | 70 |
| 71 virtual AppListControllerDelegate* GetControllerDelegate() OVERRIDE { | 71 virtual AppListControllerDelegate* GetControllerDelegate() override { |
| 72 return NULL; | 72 return NULL; |
| 73 } | 73 } |
| 74 | 74 |
| 75 // AppListServiceImpl overrides: | 75 // AppListServiceImpl overrides: |
| 76 virtual void DestroyAppList() OVERRIDE { ++destroy_app_list_call_count_; } | 76 virtual void DestroyAppList() override { ++destroy_app_list_call_count_; } |
| 77 | 77 |
| 78 private: | 78 private: |
| 79 Profile* showing_for_profile_; | 79 Profile* showing_for_profile_; |
| 80 int destroy_app_list_call_count_; | 80 int destroy_app_list_call_count_; |
| 81 | 81 |
| 82 DISALLOW_COPY_AND_ASSIGN(TestingAppListServiceImpl); | 82 DISALLOW_COPY_AND_ASSIGN(TestingAppListServiceImpl); |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 class AppListServiceUnitTest : public testing::Test { | 85 class AppListServiceUnitTest : public testing::Test { |
| 86 public: | 86 public: |
| 87 AppListServiceUnitTest() {} | 87 AppListServiceUnitTest() {} |
| 88 | 88 |
| 89 virtual void SetUp() OVERRIDE { | 89 virtual void SetUp() override { |
| 90 SetupWithCommandLine(CommandLine(CommandLine::NO_PROGRAM)); | 90 SetupWithCommandLine(CommandLine(CommandLine::NO_PROGRAM)); |
| 91 } | 91 } |
| 92 | 92 |
| 93 protected: | 93 protected: |
| 94 void SetupWithCommandLine(const CommandLine& command_line) { | 94 void SetupWithCommandLine(const CommandLine& command_line) { |
| 95 user_data_dir_ = base::FilePath(FILE_PATH_LITERAL("udd")); | 95 user_data_dir_ = base::FilePath(FILE_PATH_LITERAL("udd")); |
| 96 profile1_.reset( | 96 profile1_.reset( |
| 97 new FakeProfile("p1", user_data_dir_.AppendASCII("profile1"))); | 97 new FakeProfile("p1", user_data_dir_.AppendASCII("profile1"))); |
| 98 profile2_.reset( | 98 profile2_.reset( |
| 99 new FakeProfile("p2", user_data_dir_.AppendASCII("profile2"))); | 99 new FakeProfile("p2", user_data_dir_.AppendASCII("profile2"))); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 EXPECT_EQ(AppListService::ENABLE_FOR_APP_INSTALL, | 241 EXPECT_EQ(AppListService::ENABLE_FOR_APP_INSTALL, |
| 242 local_state_->GetInteger(prefs::kAppListEnableMethod)); | 242 local_state_->GetInteger(prefs::kAppListEnableMethod)); |
| 243 EXPECT_NE(0, local_state_->GetInt64(prefs::kAppListEnableTime)); | 243 EXPECT_NE(0, local_state_->GetInt64(prefs::kAppListEnableTime)); |
| 244 | 244 |
| 245 // An auto-show here should update the enable method to prevent recording it | 245 // An auto-show here should update the enable method to prevent recording it |
| 246 // as ENABLE_FOR_APP_INSTALL. | 246 // as ENABLE_FOR_APP_INSTALL. |
| 247 service_->AutoShowForProfile(profile1_.get()); | 247 service_->AutoShowForProfile(profile1_.get()); |
| 248 EXPECT_EQ(AppListService::ENABLE_SHOWN_UNDISCOVERED, | 248 EXPECT_EQ(AppListService::ENABLE_SHOWN_UNDISCOVERED, |
| 249 local_state_->GetInteger(prefs::kAppListEnableMethod)); | 249 local_state_->GetInteger(prefs::kAppListEnableMethod)); |
| 250 } | 250 } |
| OLD | NEW |