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

Side by Side Diff: chromecast/shell/browser/cast_browser_main_parts.cc

Issue 518773003: Chromecast: end-to-end browser test based on content::BrowserTest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cast-browser-process
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chromecast/shell/browser/cast_browser_main_parts.h" 5 #include "chromecast/shell/browser/cast_browser_main_parts.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/prefs/pref_registry_simple.h" 8 #include "base/prefs/pref_registry_simple.h"
9 #include "chromecast/common/chromecast_config.h" 9 #include "chromecast/common/chromecast_config.h"
10 #include "chromecast/metrics/cast_metrics_service_client.h" 10 #include "chromecast/metrics/cast_metrics_service_client.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 } 44 }
45 } 45 }
46 46
47 } // namespace 47 } // namespace
48 48
49 CastBrowserMainParts::CastBrowserMainParts( 49 CastBrowserMainParts::CastBrowserMainParts(
50 const content::MainFunctionParams& parameters, 50 const content::MainFunctionParams& parameters,
51 URLRequestContextFactory* url_request_context_factory) 51 URLRequestContextFactory* url_request_context_factory)
52 : BrowserMainParts(), 52 : BrowserMainParts(),
53 cast_browser_process_(new CastBrowserProcess()), 53 cast_browser_process_(new CastBrowserProcess()),
54 parameters_(parameters),
54 url_request_context_factory_(url_request_context_factory) { 55 url_request_context_factory_(url_request_context_factory) {
55 CommandLine* command_line = CommandLine::ForCurrentProcess(); 56 CommandLine* command_line = CommandLine::ForCurrentProcess();
56 AddDefaultCommandLineSwitches(command_line); 57 AddDefaultCommandLineSwitches(command_line);
57 } 58 }
58 59
59 CastBrowserMainParts::~CastBrowserMainParts() { 60 CastBrowserMainParts::~CastBrowserMainParts() {
60 } 61 }
61 62
62 void CastBrowserMainParts::PreMainMessageLoopStart() { 63 void CastBrowserMainParts::PreMainMessageLoopStart() {
63 net::NetworkChangeNotifier::SetFactory( 64 net::NetworkChangeNotifier::SetFactory(
(...skipping 21 matching lines...) Expand all
85 cast_browser_process_->SetRemoteDebuggingServer(new RemoteDebuggingServer()); 86 cast_browser_process_->SetRemoteDebuggingServer(new RemoteDebuggingServer());
86 87
87 InitializeWebUI(); 88 InitializeWebUI();
88 89
89 cast_browser_process_->SetCastService( 90 cast_browser_process_->SetCastService(
90 CastService::Create(cast_browser_process_->browser_context())); 91 CastService::Create(cast_browser_process_->browser_context()));
91 cast_browser_process_->cast_service()->Start(); 92 cast_browser_process_->cast_service()->Start();
92 } 93 }
93 94
94 bool CastBrowserMainParts::MainMessageLoopRun(int* result_code) { 95 bool CastBrowserMainParts::MainMessageLoopRun(int* result_code) {
95 base::MessageLoopForUI::current()->Run(); 96 // If parameters_.ui_task is not NULL, we are running browser tests. In this
97 // case, the browser's main message loop will not run.
98 if (parameters_.ui_task) {
99 parameters_.ui_task->Run();
100 } else {
101 base::MessageLoopForUI::current()->Run();
102 }
96 return true; 103 return true;
97 } 104 }
98 105
99 void CastBrowserMainParts::PostMainMessageLoopRun() { 106 void CastBrowserMainParts::PostMainMessageLoopRun() {
100 cast_browser_process_->cast_service()->Stop(); 107 cast_browser_process_->cast_service()->Stop();
101 cast_browser_process_.reset(); 108 cast_browser_process_.reset();
102 } 109 }
103 110
104 } // namespace shell 111 } // namespace shell
105 } // namespace chromecast 112 } // namespace chromecast
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698