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

Unified Diff: blimp/engine/session/blimp_engine_session.cc

Issue 1929723002: [Blimp] Adds blimp engine browser test framework and LoadUrl test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 | « blimp/engine/session/blimp_engine_session.h ('k') | blimp/net/tcp_engine_transport.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: blimp/engine/session/blimp_engine_session.cc
diff --git a/blimp/engine/session/blimp_engine_session.cc b/blimp/engine/session/blimp_engine_session.cc
index 3bf21099009ceb698e7e80c39e1545b96c552d6e..687171200ca5784fc0a45f2252dd50b5f1c81ea8 100644
--- a/blimp/engine/session/blimp_engine_session.cc
+++ b/blimp/engine/session/blimp_engine_session.cc
@@ -102,9 +102,8 @@ uint16_t GetListeningPort() {
&port_parsed)) {
return kDefaultPort;
}
- if (port_parsed == 0 ||
- port_parsed > 65535) {
- LOG(FATAL) << "--engine-port must be a value between 1 and 65535.";
+ if (port_parsed > 65535) {
+ LOG(FATAL) << "--engine-port must be a value between 0 and 65535.";
return kDefaultPort;
}
return port_parsed;
@@ -129,6 +128,8 @@ class EngineNetworkComponents : public ConnectionHandler,
// received messages can be properly handled.
void Initialize(const std::string& client_token);
+ uint16_t GetPortForTesting() { return port_; }
+
BrowserConnectionHandler* GetBrowserConnectionHandler();
private:
@@ -142,6 +143,7 @@ class EngineNetworkComponents : public ConnectionHandler,
net::NetLog* net_log_;
base::Closure quit_closure_;
+ uint16_t port_ = 0;
std::unique_ptr<BrowserConnectionHandler> connection_handler_;
std::unique_ptr<EngineAuthenticationHandler> authentication_handler_;
@@ -176,8 +178,11 @@ void EngineNetworkComponents::Initialize(const std::string& client_token) {
// Adds BlimpTransports to connection_manager_.
net::IPEndPoint address(GetIPv4AnyAddress(), GetListeningPort());
- connection_manager_->AddTransport(
- base::WrapUnique(new TCPEngineTransport(address, net_log_)));
+ TCPEngineTransport* transport = new TCPEngineTransport(address, net_log_);
+ connection_manager_->AddTransport(base::WrapUnique(transport));
+
+ transport->GetLocalAddress(&address);
+ port_ = address.port();
}
void EngineNetworkComponents::HandleConnection(
@@ -269,6 +274,15 @@ void BlimpEngineSession::Initialize() {
engine_config_->client_token()));
}
+void BlimpEngineSession::GetEnginePortForTesting(
+ const GetPortCallback& callback) {
+ content::BrowserThread::PostTaskAndReplyWithResult(
+ content::BrowserThread::IO, FROM_HERE,
+ base::Bind(&EngineNetworkComponents::GetPortForTesting,
+ base::Unretained(net_components_.get())),
+ callback);
+}
+
void BlimpEngineSession::RegisterFeatures() {
thread_pipe_manager_.reset(new ThreadPipeManager(
content::BrowserThread::GetMessageLoopProxyForThread(
« no previous file with comments | « blimp/engine/session/blimp_engine_session.h ('k') | blimp/net/tcp_engine_transport.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698