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

Side by Side Diff: blimp/test/browser_tests/blimp_browser_test.cc

Issue 2000883003: Fixes Blimp engine browser test due to reading client token file. (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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "blimp/test/browser_tests/blimp_browser_test.h" 5 #include "blimp/test/browser_tests/blimp_browser_test.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/base_switches.h" 9 #include "base/base_switches.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/memory/ptr_util.h" 12 #include "base/memory/ptr_util.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "base/path_service.h" 14 #include "base/path_service.h"
15 #include "base/run_loop.h" 15 #include "base/run_loop.h"
16 #include "blimp/client/app/blimp_client_switches.h" 16 #include "blimp/client/app/blimp_client_switches.h"
17 #include "blimp/client/session/assignment_source.h" 17 #include "blimp/client/session/assignment_source.h"
18 #include "blimp/common/get_client_token.h"
19 #include "blimp/common/switches.h" 18 #include "blimp/common/switches.h"
20 #include "blimp/engine/app/blimp_browser_main_parts.h" 19 #include "blimp/engine/app/blimp_browser_main_parts.h"
21 #include "blimp/engine/app/blimp_content_browser_client.h" 20 #include "blimp/engine/app/blimp_content_browser_client.h"
22 #include "blimp/engine/app/blimp_engine_config.h" 21 #include "blimp/engine/app/blimp_engine_config.h"
23 #include "blimp/engine/app/switches.h" 22 #include "blimp/engine/app/switches.h"
24 #include "blimp/engine/app/test_content_main_delegate.h" 23 #include "blimp/engine/app/test_content_main_delegate.h"
25 #include "blimp/engine/session/blimp_engine_session.h" 24 #include "blimp/engine/session/blimp_engine_session.h"
26 #include "content/public/browser/browser_thread.h" 25 #include "content/public/browser/browser_thread.h"
27 #include "content/public/browser/render_process_host.h" 26 #include "content/public/browser/render_process_host.h"
28 #include "content/public/common/url_constants.h" 27 #include "content/public/common/url_constants.h"
29 28
30 namespace blimp { 29 namespace blimp {
31 namespace { 30 namespace {
32 const char kTestDataFilePath[] = "blimp/test/data"; 31 const char kTestDataFilePath[] = "blimp/test/data";
33 const char kClientTokenFilePath[] = "blimp/test/data/test_client_token"; 32 const char kClientTokenFilePath[] = "blimp/test/data/test_client_token";
33 const char kClientToken[] = "MyVoiceIsMyPassport";
34 } // namespace 34 } // namespace
35 35
36 BlimpBrowserTest::BlimpBrowserTest() { 36 BlimpBrowserTest::BlimpBrowserTest() {
37 CreateTestServer(base::FilePath(FILE_PATH_LITERAL(kTestDataFilePath))); 37 CreateTestServer(base::FilePath(FILE_PATH_LITERAL(kTestDataFilePath)));
38 } 38 }
39 39
40 BlimpBrowserTest::~BlimpBrowserTest() {} 40 BlimpBrowserTest::~BlimpBrowserTest() {}
41 41
42 void BlimpBrowserTest::SetUp() { 42 void BlimpBrowserTest::SetUp() {
43 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 43 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
(...skipping 11 matching lines...) Expand all
55 void BlimpBrowserTest::OnGetEnginePort(uint16_t port) { 55 void BlimpBrowserTest::OnGetEnginePort(uint16_t port) {
56 DCHECK_GT(port, 0); 56 DCHECK_GT(port, 0);
57 57
58 // A test client is started after BlimpBrowserTest::SetUpOnMainThread(). 58 // A test client is started after BlimpBrowserTest::SetUpOnMainThread().
59 engine_port_ = port; 59 engine_port_ = port;
60 QuitRunLoop(); 60 QuitRunLoop();
61 } 61 }
62 62
63 client::Assignment BlimpBrowserTest::GetAssignment() { 63 client::Assignment BlimpBrowserTest::GetAssignment() {
64 client::Assignment assignment; 64 client::Assignment assignment;
65 assignment.client_token = GetClientToken( 65 assignment.client_token = kClientToken;
66 *base::CommandLine::ForCurrentProcess());
67 assignment.engine_endpoint = 66 assignment.engine_endpoint =
68 net::IPEndPoint(net::IPAddress::IPv4Localhost(), engine_port_); 67 net::IPEndPoint(net::IPAddress::IPv4Localhost(), engine_port_);
69 assignment.transport_protocol = client::Assignment::TransportProtocol::TCP; 68 assignment.transport_protocol = client::Assignment::TransportProtocol::TCP;
70 return assignment; 69 return assignment;
71 } 70 }
72 71
73 void BlimpBrowserTest::SetUpOnMainThread() { 72 void BlimpBrowserTest::SetUpOnMainThread() {
74 GetEngineSession()->GetEnginePortForTesting( 73 GetEngineSession()->GetEnginePortForTesting(
75 base::Bind(&BlimpBrowserTest::OnGetEnginePort, base::Unretained(this))); 74 base::Bind(&BlimpBrowserTest::OnGetEnginePort, base::Unretained(this)));
76 RunUntilQuit(); 75 RunUntilQuit();
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 run_loop_ = base::WrapUnique(new base::RunLoop()); 117 run_loop_ = base::WrapUnique(new base::RunLoop());
119 run_loop_->Run(); 118 run_loop_->Run();
120 run_loop_ = nullptr; 119 run_loop_ = nullptr;
121 } 120 }
122 121
123 void BlimpBrowserTest::QuitRunLoop() { 122 void BlimpBrowserTest::QuitRunLoop() {
124 run_loop_->Quit(); 123 run_loop_->Quit();
125 } 124 }
126 125
127 } // namespace blimp 126 } // namespace blimp
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698