Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2013)

Unified Diff: chrome/browser/ui/app_list/app_list_service_impl.h

Issue 24707002: Add unit tests for AppListServiceImpl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: un-const an iterator Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/app_list/app_list_service_impl.h
diff --git a/chrome/browser/ui/app_list/app_list_service_impl.h b/chrome/browser/ui/app_list/app_list_service_impl.h
index 878b5ea181323f457a5f239f136e2d145e61c790..cfcff005c6ff56ce07283e773145b3496fcc8b79 100644
--- a/chrome/browser/ui/app_list/app_list_service_impl.h
+++ b/chrome/browser/ui/app_list/app_list_service_impl.h
@@ -8,13 +8,17 @@
#include <string>
#include "base/basictypes.h"
+#include "base/command_line.h"
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_info_cache_observer.h"
-#include "chrome/browser/profiles/profile_loader.h"
#include "chrome/browser/ui/app_list/app_list_service.h"
+#include "chrome/browser/ui/app_list/keep_alive_service.h"
+#include "chrome/browser/ui/app_list/profile_loader.h"
+
+class ProfileStore;
namespace base {
class FilePath;
@@ -26,37 +30,44 @@ class AppListServiceImpl : public AppListService,
public:
static void RecordAppListLaunch();
static void RecordAppListAppLaunch();
+ virtual ~AppListServiceImpl();
+
+ // Constructor used for testing.
+ AppListServiceImpl(const CommandLine& command_line,
+ PrefService* local_state,
+ scoped_ptr<ProfileStore> profile_store,
+ scoped_ptr<KeepAliveService> keep_alive_service);
+
+ // AppListService overrides:
+ virtual void SetAppListNextPaintCallback(
+ const base::Closure& callback) OVERRIDE;
+ virtual void HandleFirstRun() OVERRIDE;
+ virtual void Init(Profile* initial_profile) OVERRIDE;
+ virtual base::FilePath GetProfilePath(
+ const base::FilePath& user_data_dir) OVERRIDE;
+ virtual void SetProfilePath(const base::FilePath& profile_path) OVERRIDE;
+ virtual void Show() OVERRIDE;
+ virtual void EnableAppList(Profile* initial_profile) OVERRIDE;
protected:
AppListServiceImpl();
- virtual ~AppListServiceImpl();
Profile* profile() const { return profile_; }
void SetProfile(Profile* new_profile);
void InvalidatePendingProfileLoads();
- ProfileLoader& profile_loader() { return profile_loader_; }
- const ProfileLoader& profile_loader() const { return profile_loader_; }
+ ProfileLoader& profile_loader() { return *profile_loader_; }
+ const ProfileLoader& profile_loader() const { return *profile_loader_; }
// Process command line flags shared between desktop implementations of the
// app list. Currently this allows for enabling or disabling the app list.
void HandleCommandLineFlags(Profile* initial_profile);
+ // Records UMA stats that try to approximate usage after a delay.
+ void SendUsageStats();
+
// Create a platform-specific shortcut for the app list.
virtual void CreateShortcut();
- // AppListService overrides:
- virtual void SetAppListNextPaintCallback(
- const base::Closure& callback) OVERRIDE;
- virtual void HandleFirstRun() OVERRIDE;
- virtual void Init(Profile* initial_profile) OVERRIDE;
-
- // Returns the app list path configured in BrowserProcess::local_state().
- virtual base::FilePath GetProfilePath(
- const base::FilePath& user_data_dir) OVERRIDE;
- virtual void SetProfilePath(const base::FilePath& profile_path) OVERRIDE;
- virtual void Show() OVERRIDE;
- virtual void EnableAppList(Profile* initial_profile) OVERRIDE;
-
private:
static void SendAppListStats();
@@ -76,16 +87,13 @@ class AppListServiceImpl : public AppListService,
// The profile the AppList is currently displaying.
Profile* profile_;
-
- // Incremented to indicate that pending profile loads are no longer valid.
- int profile_load_sequence_id_;
-
- // How many profile loads are pending.
- int pending_profile_loads_;
+ scoped_ptr<ProfileStore> profile_store_;
base::WeakPtrFactory<AppListServiceImpl> weak_factory_;
- ProfileLoader profile_loader_;
+ CommandLine command_line_;
+ PrefService* local_state_;
+ scoped_ptr<ProfileLoader> profile_loader_;
DISALLOW_COPY_AND_ASSIGN(AppListServiceImpl);
};
« no previous file with comments | « chrome/browser/profiles/profile_loader_unittest.cc ('k') | chrome/browser/ui/app_list/app_list_service_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698