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

Unified Diff: blimp/client/session/assignment_source_unittest.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: 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
Index: blimp/client/session/assignment_source_unittest.cc
diff --git a/blimp/client/session/assignment_source_unittest.cc b/blimp/client/session/assignment_source_unittest.cc
index 440b4dfe2ed8aa76eb8c24cbd2ff3aab567de5be..883e03ebc061e688811995ba7ca2e6d8864b2713 100644
--- a/blimp/client/session/assignment_source_unittest.cc
+++ b/blimp/client/session/assignment_source_unittest.cc
@@ -16,6 +16,8 @@
#include "base/thread_task_runner_handle.h"
#include "base/values.h"
#include "blimp/client/app/blimp_client_switches.h"
+#include "blimp/common/fake_commandline.h"
+#include "blimp/common/get_client_token.h"
#include "blimp/common/protocol_version.h"
#include "components/safe_json/testing_json_parser.h"
#include "net/base/test_data_directory.h"
@@ -82,6 +84,8 @@ class AssignmentSourceTest : public testing::Test {
ASSERT_FALSE(cert_list.empty());
cert_ = std::move(cert_list[0]);
ASSERT_TRUE(cert_);
+ ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
Kevin M 2016/05/10 18:06:34 This variable doesn't exist? You can compile the
CJ 2016/05/10 20:58:06 It exists in fake_commandline.h. Too obscured away
Kevin M 2016/05/11 00:39:56 Ah, I thought that test_dir_ was a private class f
CJ 2016/05/11 21:49:30 It got removed because it is unneeded in the prefe
+ CreateFileForSwitch(engine::kClientTokenPath, kTestClientToken);
}
// This expects the AssignmentSource::GetAssignment to return a custom
@@ -196,10 +200,11 @@ AssignmentSourceTest::BuildAssignerResponse() {
}
TEST_F(AssignmentSourceTest, TestTCPAlternateEndpointSuccess) {
+ auto cmd_line = CreateCommandLine(all_filepath_switches_);
Kevin M 2016/05/10 18:06:34 We should be consistent with how we're manipulatin
CJ 2016/05/10 20:58:06 Is this similar to what is done in assignment_sour
Kevin M 2016/05/11 00:39:56 Check out line 210 of this patch, which mutates th
CJ 2016/05/11 21:49:30 Done.
Assignment assignment;
assignment.transport_protocol = Assignment::TransportProtocol::TCP;
assignment.engine_endpoint = net::IPEndPoint(kTestIpAddress, kTestPort);
- assignment.client_token = kDummyClientToken;
+ assignment.client_token = GetClientToken(cmd_line);
Kevin M 2016/05/10 18:06:34 Set the expectations directly here; otherwise we c
CJ 2016/05/10 20:58:06 I'm not sure what you mean by this. What do you me
Kevin M 2016/05/11 00:39:56 In this patch, we're testing GetClientToken() by i
CJ 2016/05/11 21:49:30 So, would adding an assert like so work? Or are we
assignment.cert = scoped_refptr<net::X509Certificate>(nullptr);
base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
@@ -217,10 +222,11 @@ TEST_F(AssignmentSourceTest, TestTCPAlternateEndpointSuccess) {
}
TEST_F(AssignmentSourceTest, TestSSLAlternateEndpointSuccess) {
+ auto cmd_line = CreateCommandLine(all_filepath_switches_);
Assignment assignment;
assignment.transport_protocol = Assignment::TransportProtocol::SSL;
assignment.engine_endpoint = net::IPEndPoint(kTestIpAddress, kTestPort);
- assignment.client_token = kDummyClientToken;
+ assignment.client_token = GetClientToken(cmd_line);
assignment.cert = cert_;
base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(

Powered by Google App Engine
This is Rietveld 408576698