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

Unified Diff: blimp/engine/app/blimp_engine_config_unittest.cc

Issue 2629743003: Remove all blimp engine code (Closed)
Patch Set: Use consistent comment style in //chrome Created 3 years, 11 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
« no previous file with comments | « blimp/engine/app/blimp_engine_config.cc ('k') | blimp/engine/app/blimp_engine_crash_keys.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
deleted file mode 100644
index 8e1047cfc4cd9e0d24bad3accb4be28cbe44dc74..0000000000000000000000000000000000000000
--- a/blimp/engine/app/blimp_engine_config_unittest.cc
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "blimp/engine/app/blimp_engine_config.h"
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "base/command_line.h"
-#include "base/files/file_util.h"
-#include "base/files/scoped_temp_dir.h"
-#include "base/strings/stringprintf.h"
-#include "blimp/common/switches.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace blimp {
-namespace engine {
-namespace {
-
-// Reference client token.
-static const char kTestClientAuthToken[] = "Reference client token";
-
-class BlimpEngineConfigTest : public testing::Test {
- protected:
- void SetUp() override {
- // Create a temporary directory and populate it with all of the switches
- // If a test requires a switch's file to be missing, call
- // RemoveFileForSwitch().
- ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
- CreateFileForSwitch(kClientAuthTokenPath, kTestClientAuthToken);
- }
-
- // 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_.GetPath().Append(filepath_switch);
- }
-
- const std::vector<std::string> all_filepath_switches_ = {
- kClientAuthTokenPath};
-
- base::ScopedTempDir temp_dir_;
-};
-
-TEST_F(BlimpEngineConfigTest, ClientAuthTokenCorrect) {
- auto cmd_line = CreateCommandLine(all_filepath_switches_);
- auto engine_config = BlimpEngineConfig::Create(cmd_line);
- EXPECT_NE(nullptr, engine_config);
- EXPECT_EQ(kTestClientAuthToken, engine_config->client_auth_token());
-}
-
-TEST_F(BlimpEngineConfigTest, ClientAuthTokenEmpty) {
- RemoveFileForSwitch(kClientAuthTokenPath);
- CreateFileForSwitch(kClientAuthTokenPath, " ");
- auto cmd_line = CreateCommandLine(all_filepath_switches_);
- auto engine_config = BlimpEngineConfig::Create(cmd_line);
- EXPECT_EQ(nullptr, engine_config);
-}
-
-} // namespace
-} // namespace engine
-} // namespace blimp
« no previous file with comments | « blimp/engine/app/blimp_engine_config.cc ('k') | blimp/engine/app/blimp_engine_crash_keys.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698