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

Unified Diff: blimp/engine/app/blimp_engine_config_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/engine/app/blimp_engine_config_unittest.cc
diff --git a/blimp/engine/app/blimp_engine_config_unittest.cc b/blimp/engine/app/blimp_engine_config_unittest.cc
index d4afec281b4c78fb24962a95ab344bcae254536d..844ab9aec526f57f43c02fb3d2a8eafc7ec3cb5f 100644
--- a/blimp/engine/app/blimp_engine_config_unittest.cc
+++ b/blimp/engine/app/blimp_engine_config_unittest.cc
@@ -12,6 +12,7 @@
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/strings/stringprintf.h"
+#include "blimp/common/fake_commandline.h"
Kevin M 2016/05/10 18:06:35 Not used?
CJ 2016/05/10 20:58:07 Was being used for CreateCommandLine, but since we
#include "blimp/engine/app/switches.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -19,7 +20,6 @@ namespace blimp {
namespace engine {
namespace {
-// Reference client token.
static const char kTestClientToken[] = "Reference client token";
class BlimpEngineConfigTest : public testing::Test {
@@ -31,39 +31,6 @@ class BlimpEngineConfigTest : public testing::Test {
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
CreateFileForSwitch(kClientTokenPath, kTestClientToken);
}
-
- // Creates a file in the temp directory for a given filepath switch.
- void CreateFileForSwitch(const std::string& filepath_switch,
- const std::string& data) const {
- ASSERT_TRUE(base::WriteFile(GetFilepathForSwitch(filepath_switch),
- data.c_str(), data.size()));
- }
-
- // Removes the associated file for a given filepath switch.
- void RemoveFileForSwitch(const std::string& filepath_switch) const {
- base::DeleteFile(GetFilepathForSwitch(filepath_switch), false);
- }
-
- // Creates and returns a CommandLine object with specified filepath switches.
- base::CommandLine CreateCommandLine(
- const std::vector<std::string>& filepath_switches) {
- base::CommandLine::StringVector cmd_vec = {"dummy_program"};
- for (const std::string& filepath_switch : filepath_switches) {
- cmd_vec.push_back(base::StringPrintf(
- "--%s=%s", filepath_switch.c_str(),
- GetFilepathForSwitch(filepath_switch).AsUTF8Unsafe().c_str()));
- }
- return base::CommandLine(cmd_vec);
- }
-
- base::FilePath GetFilepathForSwitch(
- const std::string& filepath_switch) const {
- return temp_dir_.path().Append(filepath_switch);
- }
-
- const std::vector<std::string> all_filepath_switches_ = {kClientTokenPath};
-
- base::ScopedTempDir temp_dir_;
};
TEST_F(BlimpEngineConfigTest, ClientTokenCorrect) {

Powered by Google App Engine
This is Rietveld 408576698