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

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

Issue 2281783002: Changes client_token to be client_auth_token. (Closed)
Patch Set: Linting. Created 4 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 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/engine/browser_tests/blimp_browser_test.h" 5 #include "blimp/engine/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"
(...skipping 12 matching lines...) Expand all
23 #include "blimp/engine/app/test_content_main_delegate.h" 23 #include "blimp/engine/app/test_content_main_delegate.h"
24 #include "blimp/engine/session/blimp_engine_session.h" 24 #include "blimp/engine/session/blimp_engine_session.h"
25 #include "content/public/browser/browser_thread.h" 25 #include "content/public/browser/browser_thread.h"
26 #include "content/public/browser/render_process_host.h" 26 #include "content/public/browser/render_process_host.h"
27 #include "content/public/common/url_constants.h" 27 #include "content/public/common/url_constants.h"
28 #include "content/public/test/test_utils.h" 28 #include "content/public/test/test_utils.h"
29 29
30 namespace blimp { 30 namespace blimp {
31 namespace { 31 namespace {
32 const char kTestDataFilePath[] = "blimp/test/data"; 32 const char kTestDataFilePath[] = "blimp/test/data";
33 const char kClientTokenFilePath[] = "blimp/test/data/test_client_token"; 33 const char kClientAuthTokenFilePath[] = "blimp/test/data/test_client_token";
34 const char kClientToken[] = "MyVoiceIsMyPassport"; 34 const char kClientAuthToken[] = "MyVoiceIsMyPassport";
35 } // namespace 35 } // namespace
36 36
37 37
38 BlimpBrowserTest::BlimpBrowserTest() 38 BlimpBrowserTest::BlimpBrowserTest()
39 : completion_event_(base::WaitableEvent::ResetPolicy::MANUAL, 39 : completion_event_(base::WaitableEvent::ResetPolicy::MANUAL,
40 base::WaitableEvent::InitialState::NOT_SIGNALED) { 40 base::WaitableEvent::InitialState::NOT_SIGNALED) {
41 CreateTestServer(base::FilePath(FILE_PATH_LITERAL(kTestDataFilePath))); 41 CreateTestServer(base::FilePath(FILE_PATH_LITERAL(kTestDataFilePath)));
42 } 42 }
43 43
44 BlimpBrowserTest::~BlimpBrowserTest() {} 44 BlimpBrowserTest::~BlimpBrowserTest() {}
(...skipping 18 matching lines...) Expand all
63 63
64 engine::BlimpEngineSession* BlimpBrowserTest::GetEngineSession() { 64 engine::BlimpEngineSession* BlimpBrowserTest::GetEngineSession() {
65 return engine::TestContentMainDelegate::GetInstance() 65 return engine::TestContentMainDelegate::GetInstance()
66 ->browser_client() 66 ->browser_client()
67 ->blimp_browser_main_parts() 67 ->blimp_browser_main_parts()
68 ->GetBlimpEngineSession(); 68 ->GetBlimpEngineSession();
69 } 69 }
70 70
71 client::Assignment BlimpBrowserTest::GetAssignment() { 71 client::Assignment BlimpBrowserTest::GetAssignment() {
72 client::Assignment assignment; 72 client::Assignment assignment;
73 assignment.client_token = kClientToken; 73 assignment.client_auth_token = kClientAuthToken;
74 assignment.engine_endpoint = 74 assignment.engine_endpoint =
75 net::IPEndPoint(net::IPAddress::IPv4Localhost(), engine_port_); 75 net::IPEndPoint(net::IPAddress::IPv4Localhost(), engine_port_);
76 assignment.transport_protocol = client::Assignment::TransportProtocol::TCP; 76 assignment.transport_protocol = client::Assignment::TransportProtocol::TCP;
77 return assignment; 77 return assignment;
78 } 78 }
79 79
80 void BlimpBrowserTest::SetUpCommandLine(base::CommandLine* command_line) { 80 void BlimpBrowserTest::SetUpCommandLine(base::CommandLine* command_line) {
81 // Engine switches. 81 // Engine switches.
82 blimp::engine::SetCommandLineDefaults(command_line); 82 blimp::engine::SetCommandLineDefaults(command_line);
83 83
84 // Pass through the engine port if it is passed to the test. 84 // Pass through the engine port if it is passed to the test.
85 // Otherwise, use a dynamic port. 85 // Otherwise, use a dynamic port.
86 if (!command_line->HasSwitch(blimp::engine::kEnginePort)) { 86 if (!command_line->HasSwitch(blimp::engine::kEnginePort)) {
87 command_line->AppendSwitchASCII(blimp::engine::kEnginePort, "0"); 87 command_line->AppendSwitchASCII(blimp::engine::kEnginePort, "0");
88 } 88 }
89 89
90 base::FilePath src_root; 90 base::FilePath src_root;
91 PathService::Get(base::DIR_SOURCE_ROOT, &src_root); 91 PathService::Get(base::DIR_SOURCE_ROOT, &src_root);
92 command_line->AppendSwitchASCII(kClientTokenPath, 92 command_line->AppendSwitchASCII(
93 src_root.Append(kClientTokenFilePath).value()); 93 kClientAuthTokenPath, src_root.Append(kClientAuthTokenFilePath).value());
94 } 94 }
95 95
96 void BlimpBrowserTest::SetUpOnMainThread() { 96 void BlimpBrowserTest::SetUpOnMainThread() {
97 // Get the connection's port number across the IO/UI thread boundary. 97 // Get the connection's port number across the IO/UI thread boundary.
98 GetEngineSession()->GetEnginePortForTesting(base::Bind( 98 GetEngineSession()->GetEnginePortForTesting(base::Bind(
99 &BlimpBrowserTest::OnGetEnginePortCompletion, base::Unretained(this))); 99 &BlimpBrowserTest::OnGetEnginePortCompletion, base::Unretained(this)));
100 100
101 RunUntilCompletion(); 101 RunUntilCompletion();
102 } 102 }
103 103
(...skipping 14 matching lines...) Expand all
118 i.GetCurrentValue()->FastShutdownIfPossible(); 118 i.GetCurrentValue()->FastShutdownIfPossible();
119 } 119 }
120 } 120 }
121 121
122 void BlimpBrowserTest::OnGetEnginePortCompletion(uint16_t port) { 122 void BlimpBrowserTest::OnGetEnginePortCompletion(uint16_t port) {
123 engine_port_ = port; 123 engine_port_ = port;
124 SignalCompletion(); 124 SignalCompletion();
125 } 125 }
126 126
127 } // namespace blimp 127 } // namespace blimp
OLDNEW
« no previous file with comments | « blimp/engine/app/blimp_engine_config_unittest.cc ('k') | blimp/engine/session/blimp_engine_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698