| Index: blimp/client/core/session/assignment_source_unittest.cc
|
| diff --git a/blimp/client/core/session/assignment_source_unittest.cc b/blimp/client/core/session/assignment_source_unittest.cc
|
| index 4513012d123024966bebc2c29b0c6c95aee2e29e..595cc788b5edc76465607796e3cf3f98a3b4eff7 100644
|
| --- a/blimp/client/core/session/assignment_source_unittest.cc
|
| +++ b/blimp/client/core/session/assignment_source_unittest.cc
|
| @@ -4,6 +4,9 @@
|
|
|
| #include "blimp/client/core/session/assignment_source.h"
|
|
|
| +#include <memory>
|
| +#include <utility>
|
| +
|
| #include "base/command_line.h"
|
| #include "base/files/file_path.h"
|
| #include "base/files/file_util.h"
|
| @@ -17,7 +20,7 @@
|
| #include "base/threading/thread_task_runner_handle.h"
|
| #include "base/values.h"
|
| #include "blimp/client/core/blimp_client_switches.h"
|
| -#include "blimp/common/get_client_token.h"
|
| +#include "blimp/common/get_client_auth_token.h"
|
| #include "blimp/common/protocol_version.h"
|
| #include "blimp/common/switches.h"
|
| #include "components/safe_json/testing_json_parser.h"
|
| @@ -45,15 +48,15 @@ const char kTcpTransportName[] = "tcp";
|
| const char kSslTransportName[] = "ssl";
|
| const char kCertRelativePath[] =
|
| "blimp/client/core/session/test_selfsigned_cert.pem";
|
| -const char kTestClientToken[] = "secrett0ken";
|
| +const char kTestClientAuthToken[] = "secrett0ken";
|
| const char kTestAuthToken[] = "UserAuthT0kenz";
|
| const char kAssignerUrl[] = "http://www.assigner.test/";
|
| -const char kTestClientTokenPath[] = "blimp/test/data/test_client_token";
|
| +const char kTestClientAuthTokenPath[] = "blimp/test/data/test_client_token";
|
|
|
| MATCHER_P(AssignmentEquals, assignment, "") {
|
| return arg.transport_protocol == assignment.transport_protocol &&
|
| arg.engine_endpoint == assignment.engine_endpoint &&
|
| - arg.client_token == assignment.client_token &&
|
| + arg.client_auth_token == assignment.client_auth_token &&
|
| ((!assignment.cert && !arg.cert) ||
|
| (arg.cert && assignment.cert &&
|
| arg.cert->Equals(assignment.cert.get())));
|
| @@ -78,7 +81,7 @@ class AssignmentSourceTest : public testing::Test {
|
| PathService::Get(base::DIR_SOURCE_ROOT, &src_root);
|
| ASSERT_FALSE(src_root.empty());
|
| cert_path_ = src_root.Append(kCertRelativePath);
|
| - client_token_path_ = src_root.Append(kTestClientTokenPath);
|
| + client_auth_token_path_ = src_root.Append(kTestClientAuthTokenPath);
|
| ASSERT_TRUE(base::ReadFileToString(cert_path_, &cert_pem_));
|
| net::CertificateList cert_list =
|
| net::X509Certificate::CreateCertificateListFromBytes(
|
| @@ -169,8 +172,8 @@ class AssignmentSourceTest : public testing::Test {
|
| // Path to the PEM-encoded certificate chain.
|
| base::FilePath cert_path_;
|
|
|
| - // Path to the client token;
|
| - base::FilePath client_token_path_;
|
| + // Path to the client auth token;
|
| + base::FilePath client_auth_token_path_;
|
|
|
| // Payload of PEM certificate chain at |cert_path_|.
|
| std::string cert_pem_;
|
| @@ -189,7 +192,7 @@ Assignment AssignmentSourceTest::BuildSslAssignment() {
|
| Assignment assignment;
|
| assignment.transport_protocol = Assignment::TransportProtocol::SSL;
|
| assignment.engine_endpoint = net::IPEndPoint(kTestIpAddress, kTestPort);
|
| - assignment.client_token = kTestClientToken;
|
| + assignment.client_auth_token = kTestClientAuthToken;
|
| assignment.cert = cert_;
|
| return assignment;
|
| }
|
| @@ -197,7 +200,7 @@ Assignment AssignmentSourceTest::BuildSslAssignment() {
|
| std::unique_ptr<base::DictionaryValue>
|
| AssignmentSourceTest::BuildAssignerResponse() {
|
| std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
|
| - dict->SetString("clientToken", kTestClientToken);
|
| + dict->SetString("clientToken", kTestClientAuthToken);
|
| dict->SetString("host", kTestIpAddressString);
|
| dict->SetInteger("port", kTestPort);
|
| dict->SetString("certificate", cert_pem_);
|
| @@ -215,11 +218,12 @@ TEST_F(AssignmentSourceTest, TestTCPAlternateEndpointSuccess) {
|
| cmd_line->AppendSwitchASCII(switches::kEnginePort,
|
| std::to_string(kTestPort));
|
| cmd_line->AppendSwitchASCII(switches::kEngineTransport, kTcpTransportName);
|
| - cmd_line->AppendSwitchASCII(kClientTokenPath, client_token_path_.value());
|
| + cmd_line->AppendSwitchASCII(kClientAuthTokenPath,
|
| + client_auth_token_path_.value());
|
|
|
| - assignment.client_token = GetClientToken(*cmd_line);
|
| + assignment.client_auth_token = GetClientAuthToken(*cmd_line);
|
|
|
| - CHECK_EQ("MyVoiceIsMyPassport", assignment.client_token);
|
| + CHECK_EQ("MyVoiceIsMyPassport", assignment.client_auth_token);
|
|
|
| EXPECT_CALL(*this, AssignmentResponse(ASSIGNMENT_REQUEST_RESULT_OK,
|
| AssignmentEquals(assignment)))
|
| @@ -241,9 +245,10 @@ TEST_F(AssignmentSourceTest, TestSSLAlternateEndpointSuccess) {
|
| std::to_string(kTestPort));
|
| cmd_line->AppendSwitchASCII(switches::kEngineTransport, kSslTransportName);
|
| cmd_line->AppendSwitchASCII(switches::kEngineCertPath, cert_path_.value());
|
| - cmd_line->AppendSwitchASCII(kClientTokenPath, client_token_path_.value());
|
| + cmd_line->AppendSwitchASCII(kClientAuthTokenPath,
|
| + client_auth_token_path_.value());
|
|
|
| - assignment.client_token = GetClientToken(*cmd_line);
|
| + assignment.client_auth_token = GetClientAuthToken(*cmd_line);
|
|
|
| EXPECT_CALL(*this, AssignmentResponse(ASSIGNMENT_REQUEST_RESULT_OK,
|
| AssignmentEquals(assignment)))
|
|
|