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

Unified Diff: chrome/test/chromedriver/chrome_finder_unittest.cc

Issue 12848005: [chromedriver] Separate stuff of chrome from chromedriver. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments and fix compile error on mac. Created 7 years, 9 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 | « chrome/test/chromedriver/chrome_finder_mac.mm ('k') | chrome/test/chromedriver/chrome_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/chromedriver/chrome_finder_unittest.cc
diff --git a/chrome/test/chromedriver/chrome_finder_unittest.cc b/chrome/test/chromedriver/chrome_finder_unittest.cc
deleted file mode 100644
index 7815c7ee80aabc7f6e6c253c1ef219fed799547e..0000000000000000000000000000000000000000
--- a/chrome/test/chromedriver/chrome_finder_unittest.cc
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyright (c) 2012 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 <string>
-#include <vector>
-
-#include "base/bind.h"
-#include "base/files/file_path.h"
-#include "chrome/test/chromedriver/chrome_finder.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace {
-
-bool PathIn(const std::vector<base::FilePath>& list,
- const base::FilePath& path) {
- for (size_t i = 0; i < list.size(); ++i) {
- if (list[i] == path)
- return true;
- }
- return false;
-}
-
-void AssertFound(const base::FilePath& found,
- const std::vector<base::FilePath>& existing_paths,
- const std::vector<base::FilePath>& rel_paths,
- const std::vector<base::FilePath>& locations) {
- base::FilePath exe;
- ASSERT_TRUE(internal::FindExe(
- base::Bind(&PathIn, existing_paths),
- rel_paths,
- locations,
- &exe));
- ASSERT_EQ(found, exe);
-}
-
-} // namespace
-
-TEST(ChromeFinderTest, FindExeFound) {
- base::FilePath found =
- base::FilePath().AppendASCII("exists").AppendASCII("exists");
- std::vector<base::FilePath> existing_paths;
- existing_paths.push_back(found);
- std::vector<base::FilePath> rel_paths;
- rel_paths.push_back(found.BaseName());
- std::vector<base::FilePath> locations;
- locations.push_back(found.DirName());
- ASSERT_NO_FATAL_FAILURE(
- AssertFound(found, existing_paths, rel_paths, locations));
-}
-
-TEST(ChromeFinderTest, FindExeShouldGoInOrder) {
- base::FilePath dir(FILE_PATH_LITERAL("dir"));
- base::FilePath first = dir.AppendASCII("first");
- base::FilePath second = dir.AppendASCII("second");
- std::vector<base::FilePath> existing_paths;
- existing_paths.push_back(first);
- existing_paths.push_back(second);
- std::vector<base::FilePath> rel_paths;
- rel_paths.push_back(first.BaseName());
- rel_paths.push_back(second.BaseName());
- std::vector<base::FilePath> locations;
- locations.push_back(dir);
- ASSERT_NO_FATAL_FAILURE(
- AssertFound(first, existing_paths, rel_paths, locations));
-}
-
-TEST(ChromeFinderTest, FindExeShouldPreferExeNameOverDir) {
- base::FilePath dir1(FILE_PATH_LITERAL("dir1"));
- base::FilePath dir2(FILE_PATH_LITERAL("dir2"));
- base::FilePath preferred(FILE_PATH_LITERAL("preferred"));
- base::FilePath nonpreferred(FILE_PATH_LITERAL("nonpreferred"));
- std::vector<base::FilePath> existing_paths;
- existing_paths.push_back(dir2.Append(preferred));
- existing_paths.push_back(dir1.Append(nonpreferred));
- std::vector<base::FilePath> rel_paths;
- rel_paths.push_back(preferred);
- rel_paths.push_back(nonpreferred);
- std::vector<base::FilePath> locations;
- locations.push_back(dir1);
- locations.push_back(dir2);
- ASSERT_NO_FATAL_FAILURE(AssertFound(
- dir2.Append(preferred), existing_paths, rel_paths, locations));
-}
-
-TEST(ChromeFinderTest, FindExeNotFound) {
- base::FilePath found =
- base::FilePath().AppendASCII("exists").AppendASCII("exists");
- std::vector<base::FilePath> existing_paths;
- std::vector<base::FilePath> rel_paths;
- rel_paths.push_back(found.BaseName());
- std::vector<base::FilePath> locations;
- locations.push_back(found.DirName());
- base::FilePath exe;
- ASSERT_FALSE(internal::FindExe(
- base::Bind(&PathIn, existing_paths),
- rel_paths,
- locations,
- &exe));
-}
-
-TEST(ChromeFinderTest, NoCrash) {
- // It's not worthwhile to check the validity of the path, so just check
- // for crashes.
- base::FilePath exe;
- FindChrome(&exe);
-}
« no previous file with comments | « chrome/test/chromedriver/chrome_finder_mac.mm ('k') | chrome/test/chromedriver/chrome_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698