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

Unified Diff: apps/shell/browser/shell_browser_main_parts.cc

Issue 224723022: Add the first app_shell_browsertest test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: temp dep Created 6 years, 8 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 | « apps/shell/browser/shell_browser_main_parts.h ('k') | apps/shell/browser/shell_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: apps/shell/browser/shell_browser_main_parts.cc
diff --git a/apps/shell/browser/shell_browser_main_parts.cc b/apps/shell/browser/shell_browser_main_parts.cc
index 7cc53e5008951f5632c984ae0648345aa32a85aa..9ce8a1c9863bf7d6bad9ad444d127b13215206a2 100644
--- a/apps/shell/browser/shell_browser_main_parts.cc
+++ b/apps/shell/browser/shell_browser_main_parts.cc
@@ -43,7 +43,9 @@ namespace apps {
ShellBrowserMainParts::ShellBrowserMainParts(
const content::MainFunctionParams& parameters)
- : extension_system_(NULL), parameters_(parameters) {}
+ : extension_system_(NULL),
+ parameters_(parameters),
+ run_message_loop_(true) {}
ShellBrowserMainParts::~ShellBrowserMainParts() {
}
@@ -66,6 +68,9 @@ int ShellBrowserMainParts::PreCreateThreads() {
}
void ShellBrowserMainParts::PreMainMessageLoopRun() {
+ // Initialize our "profile" equivalent.
+ browser_context_.reset(new ShellBrowserContext);
+
desktop_controller_.reset(new ShellDesktopController);
desktop_controller_->GetWindowTreeHost()->AddObserver(this);
@@ -73,9 +78,6 @@ void ShellBrowserMainParts::PreMainMessageLoopRun() {
// TODO(jamescook): Initialize chromeos::UserManager.
net_log_.reset(new content::ShellNetLog("app_shell"));
- // Initialize our "profile" equivalent.
- browser_context_.reset(new ShellBrowserContext);
-
extensions_client_.reset(new ShellExtensionsClient());
extensions::ExtensionsClient::Set(extensions_client_.get());
@@ -95,27 +97,26 @@ void ShellBrowserMainParts::PreMainMessageLoopRun() {
devtools_delegate_.reset(
new content::ShellDevToolsDelegate(browser_context_.get()));
- // For running browser tests.
- // TODO(yoz): This is set up to exit prematurely because we don't have
- // any tests yet.
- if (parameters_.ui_task) {
- parameters_.ui_task->Run();
- delete parameters_.ui_task;
- return;
- }
-
const std::string kAppSwitch = "app";
CommandLine* command_line = CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(kAppSwitch)) {
base::FilePath app_dir(command_line->GetSwitchValueNative(kAppSwitch));
base::FilePath app_absolute_dir = base::MakeAbsoluteFilePath(app_dir);
extension_system_->LoadAndLaunchApp(app_absolute_dir);
+ } else if (parameters_.ui_task) {
+ // For running browser tests.
+ parameters_.ui_task->Run();
+ delete parameters_.ui_task;
+ run_message_loop_ = false;
} else {
LOG(ERROR) << "--" << kAppSwitch << " unset; boredom is in your future";
}
}
bool ShellBrowserMainParts::MainMessageLoopRun(int* result_code) {
+ if (!run_message_loop_)
+ return true;
+ // TODO(yoz): just return false here?
base::RunLoop run_loop;
run_loop.Run();
*result_code = content::RESULT_CODE_NORMAL_EXIT;
« no previous file with comments | « apps/shell/browser/shell_browser_main_parts.h ('k') | apps/shell/browser/shell_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698