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

Unified Diff: chrome/browser/ui/app_list/test/chrome_app_list_test_support.cc

Issue 552153002: Adds AppListServiceImplBrowserTest.ShowLoadedProfiles (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@20140908-AppList-ALVD-SpeechUI-fromcl
Patch Set: respond to commments Created 6 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
« no previous file with comments | « chrome/browser/ui/app_list/test/chrome_app_list_test_support.h ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/app_list/test/chrome_app_list_test_support.cc
diff --git a/chrome/browser/ui/app_list/test/chrome_app_list_test_support.cc b/chrome/browser/ui/app_list/test/chrome_app_list_test_support.cc
index 34f6f83d621872edbab5abf39c377bb7a58dea7b..bfc943ed38b843e11e5a8cef84abb69793ad0676 100644
--- a/chrome/browser/ui/app_list/test/chrome_app_list_test_support.cc
+++ b/chrome/browser/ui/app_list/test/chrome_app_list_test_support.cc
@@ -4,12 +4,53 @@
#include "chrome/browser/ui/app_list/test/chrome_app_list_test_support.h"
+#include "base/run_loop.h"
+#include "chrome/browser/browser_process.h"
+#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/app_list/app_list_service.h"
+#include "chrome/browser/ui/app_list/app_list_service_impl.h"
#include "chrome/browser/ui/app_list/app_list_syncable_service.h"
#include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h"
namespace test {
+namespace {
+
+class CreateProfileHelper {
+ public:
+ CreateProfileHelper() : profile_(NULL) {}
+
+ Profile* CreateAsync() {
+ ProfileManager* profile_manager = g_browser_process->profile_manager();
+ base::FilePath temp_profile_dir =
+ profile_manager->user_data_dir().AppendASCII("Profile 1");
+ profile_manager->CreateProfileAsync(
+ temp_profile_dir,
+ base::Bind(&CreateProfileHelper::OnProfileCreated,
+ base::Unretained(this)),
+ base::string16(),
+ base::string16(),
+ std::string());
+ run_loop_.Run();
+ return profile_;
+ }
+
+ private:
+ void OnProfileCreated(Profile* profile, Profile::CreateStatus status) {
+ if (status == Profile::CREATE_STATUS_INITIALIZED) {
+ profile_ = profile;
+ run_loop_.Quit();
+ }
+ }
+
+ base::RunLoop run_loop_;
+ Profile* profile_;
+
+ DISALLOW_COPY_AND_ASSIGN(CreateProfileHelper);
+};
+
+} // namespace
+
app_list::AppListModel* GetAppListModel(AppListService* service) {
return app_list::AppListSyncableServiceFactory::GetForProfile(
service->GetCurrentAppListProfile())->model();
@@ -20,4 +61,15 @@ AppListService* GetAppListService() {
return AppListService::Get(chrome::GetActiveDesktop());
}
+AppListServiceImpl* GetAppListServiceImpl() {
+ // AppListServiceImpl is the only subclass of AppListService, which has pure
+ // virtuals. So this must either be NULL, or an AppListServiceImpl.
+ return static_cast<AppListServiceImpl*>(GetAppListService());
+}
+
+Profile* CreateSecondProfileAsync() {
+ CreateProfileHelper helper;
+ return helper.CreateAsync();
+}
+
} // namespace test
« no previous file with comments | « chrome/browser/ui/app_list/test/chrome_app_list_test_support.h ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698