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

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

Issue 1958033003: Allows client to access auth token from command line specified file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed kmarshall's comments 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
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/run_loop.h" 14 #include "base/run_loop.h"
15 #include "blimp/client/app/blimp_client_switches.h" 15 #include "blimp/client/app/blimp_client_switches.h"
16 #include "blimp/client/session/assignment_source.h" 16 #include "blimp/client/session/assignment_source.h"
17 #include "blimp/common/get_client_token.h"
18 #include "blimp/common/switches.h"
17 #include "blimp/engine/app/blimp_browser_main_parts.h" 19 #include "blimp/engine/app/blimp_browser_main_parts.h"
18 #include "blimp/engine/app/blimp_content_browser_client.h" 20 #include "blimp/engine/app/blimp_content_browser_client.h"
19 #include "blimp/engine/app/blimp_engine_config.h" 21 #include "blimp/engine/app/blimp_engine_config.h"
20 #include "blimp/engine/app/switches.h"
21 #include "blimp/engine/app/test_content_main_delegate.h" 22 #include "blimp/engine/app/test_content_main_delegate.h"
22 #include "blimp/engine/session/blimp_engine_session.h" 23 #include "blimp/engine/session/blimp_engine_session.h"
23 #include "content/public/browser/browser_thread.h" 24 #include "content/public/browser/browser_thread.h"
24 #include "content/public/browser/render_process_host.h" 25 #include "content/public/browser/render_process_host.h"
25 #include "content/public/common/url_constants.h" 26 #include "content/public/common/url_constants.h"
26 27
27 namespace blimp { 28 namespace blimp {
28 namespace { 29 namespace {
29 const char kTestDataFilePath[] = "blimp/engine/test/data"; 30 const char kTestDataFilePath[] = "blimp/engine/test/data";
30 const char kClientTokenFilePath[] = "blimp/test/data/test_client_token"; 31 const char kClientTokenFilePath[] = "blimp/test/data/test_client_token";
(...skipping 21 matching lines...) Expand all
52 void BlimpBrowserTest::OnGetEnginePort(uint16_t port) { 53 void BlimpBrowserTest::OnGetEnginePort(uint16_t port) {
53 DCHECK_GT(port, 0); 54 DCHECK_GT(port, 0);
54 55
55 // A test client is started after BlimpBrowserTest::SetUpOnMainThread(). 56 // A test client is started after BlimpBrowserTest::SetUpOnMainThread().
56 engine_port_ = port; 57 engine_port_ = port;
57 QuitRunLoop(); 58 QuitRunLoop();
58 } 59 }
59 60
60 client::Assignment BlimpBrowserTest::GetAssignment() { 61 client::Assignment BlimpBrowserTest::GetAssignment() {
61 client::Assignment assignment; 62 client::Assignment assignment;
62 assignment.client_token = client::kDummyClientToken; 63 assignment.client_token = GetClientToken(command_line);
63 assignment.engine_endpoint = 64 assignment.engine_endpoint =
64 net::IPEndPoint(net::IPAddress::IPv4Localhost(), engine_port_); 65 net::IPEndPoint(net::IPAddress::IPv4Localhost(), engine_port_);
65 assignment.transport_protocol = client::Assignment::TransportProtocol::TCP; 66 assignment.transport_protocol = client::Assignment::TransportProtocol::TCP;
66 return assignment; 67 return assignment;
67 } 68 }
68 69
69 void BlimpBrowserTest::SetUpOnMainThread() { 70 void BlimpBrowserTest::SetUpOnMainThread() {
70 GetEngineSession()->GetEnginePortForTesting( 71 GetEngineSession()->GetEnginePortForTesting(
71 base::Bind(&BlimpBrowserTest::OnGetEnginePort, base::Unretained(this))); 72 base::Bind(&BlimpBrowserTest::OnGetEnginePort, base::Unretained(this)));
72 RunUntilQuit(); 73 RunUntilQuit();
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 run_loop_ = base::WrapUnique(new base::RunLoop()); 113 run_loop_ = base::WrapUnique(new base::RunLoop());
113 run_loop_->Run(); 114 run_loop_->Run();
114 run_loop_ = nullptr; 115 run_loop_ = nullptr;
115 } 116 }
116 117
117 void BlimpBrowserTest::QuitRunLoop() { 118 void BlimpBrowserTest::QuitRunLoop() {
118 run_loop_->Quit(); 119 run_loop_->Quit();
119 } 120 }
120 121
121 } // namespace blimp 122 } // namespace blimp
OLDNEW
« blimp/engine/app/ui/blimp_screen_unittest.cc ('K') | « blimp/test/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698