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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 Profile* showing_for_profile_; | 70 Profile* showing_for_profile_; |
71 int destroy_app_list_call_count_; | 71 int destroy_app_list_call_count_; |
72 | 72 |
73 DISALLOW_COPY_AND_ASSIGN(TestingAppListServiceImpl); | 73 DISALLOW_COPY_AND_ASSIGN(TestingAppListServiceImpl); |
74 }; | 74 }; |
75 | 75 |
76 class AppListServiceUnitTest : public testing::Test { | 76 class AppListServiceUnitTest : public testing::Test { |
77 public: | 77 public: |
78 AppListServiceUnitTest() {} | 78 AppListServiceUnitTest() {} |
79 | 79 |
80 virtual void SetUp() override { | 80 void SetUp() override { |
81 SetupWithCommandLine(CommandLine(CommandLine::NO_PROGRAM)); | 81 SetupWithCommandLine(CommandLine(CommandLine::NO_PROGRAM)); |
82 } | 82 } |
83 | 83 |
84 protected: | 84 protected: |
85 void SetupWithCommandLine(const CommandLine& command_line) { | 85 void SetupWithCommandLine(const CommandLine& command_line) { |
86 user_data_dir_ = base::FilePath(FILE_PATH_LITERAL("udd")); | 86 user_data_dir_ = base::FilePath(FILE_PATH_LITERAL("udd")); |
87 profile1_.reset( | 87 profile1_.reset( |
88 new FakeProfile("p1", user_data_dir_.AppendASCII("profile1"))); | 88 new FakeProfile("p1", user_data_dir_.AppendASCII("profile1"))); |
89 profile2_.reset( | 89 profile2_.reset( |
90 new FakeProfile("p2", user_data_dir_.AppendASCII("profile2"))); | 90 new FakeProfile("p2", user_data_dir_.AppendASCII("profile2"))); |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 EXPECT_EQ(AppListService::ENABLE_FOR_APP_INSTALL, | 232 EXPECT_EQ(AppListService::ENABLE_FOR_APP_INSTALL, |
233 local_state_->GetInteger(prefs::kAppListEnableMethod)); | 233 local_state_->GetInteger(prefs::kAppListEnableMethod)); |
234 EXPECT_NE(0, local_state_->GetInt64(prefs::kAppListEnableTime)); | 234 EXPECT_NE(0, local_state_->GetInt64(prefs::kAppListEnableTime)); |
235 | 235 |
236 // An auto-show here should update the enable method to prevent recording it | 236 // An auto-show here should update the enable method to prevent recording it |
237 // as ENABLE_FOR_APP_INSTALL. | 237 // as ENABLE_FOR_APP_INSTALL. |
238 service_->ShowForAppInstall(profile1_.get(), "", false); | 238 service_->ShowForAppInstall(profile1_.get(), "", false); |
239 EXPECT_EQ(AppListService::ENABLE_SHOWN_UNDISCOVERED, | 239 EXPECT_EQ(AppListService::ENABLE_SHOWN_UNDISCOVERED, |
240 local_state_->GetInteger(prefs::kAppListEnableMethod)); | 240 local_state_->GetInteger(prefs::kAppListEnableMethod)); |
241 } | 241 } |
OLD | NEW |