Index: chrome/test/chromedriver/chrome_launcher_unittest.cc |
diff --git a/chrome/test/chromedriver/chrome_launcher_unittest.cc b/chrome/test/chromedriver/chrome_launcher_unittest.cc |
index c61346051b3812a84d93704690f76c1d11d6a863..a0df670fdb83df022102cf9d17a17558c300c1bb 100644 |
--- a/chrome/test/chromedriver/chrome_launcher_unittest.cc |
+++ b/chrome/test/chromedriver/chrome_launcher_unittest.cc |
@@ -18,14 +18,14 @@ |
#include "testing/gtest/include/gtest/gtest.h" |
TEST(ProcessExtensions, NoExtension) { |
- CommandLine command(CommandLine::NO_PROGRAM); |
+ Switches switches; |
std::vector<std::string> extensions; |
base::FilePath extension_dir; |
std::vector<std::string> bg_pages; |
Status status = internal::ProcessExtensions(extensions, extension_dir, |
- false, &command, &bg_pages); |
+ false, &switches, &bg_pages); |
ASSERT_TRUE(status.IsOk()); |
- ASSERT_FALSE(command.HasSwitch("load-extension")); |
+ ASSERT_FALSE(switches.HasSwitch("load-extension")); |
ASSERT_EQ(0u, bg_pages.size()); |
} |
@@ -53,13 +53,13 @@ TEST(ProcessExtensions, SingleExtensionWithBgPage) { |
base::ScopedTempDir extension_dir; |
ASSERT_TRUE(extension_dir.CreateUniqueTempDir()); |
- CommandLine command(CommandLine::NO_PROGRAM); |
+ Switches switches; |
std::vector<std::string> bg_pages; |
Status status = internal::ProcessExtensions(extensions, extension_dir.path(), |
- false, &command, &bg_pages); |
+ false, &switches, &bg_pages); |
ASSERT_TRUE(status.IsOk()); |
- ASSERT_TRUE(command.HasSwitch("load-extension")); |
- base::FilePath temp_ext_path = command.GetSwitchValuePath("load-extension"); |
+ ASSERT_TRUE(switches.HasSwitch("load-extension")); |
+ base::FilePath temp_ext_path(switches.GetSwitchValueNative("load-extension")); |
ASSERT_TRUE(base::PathExists(temp_ext_path)); |
std::string manifest_txt; |
ASSERT_TRUE(file_util::ReadFileToString( |
@@ -91,13 +91,13 @@ TEST(ProcessExtensions, MultipleExtensionsNoBgPages) { |
base::ScopedTempDir extension_dir; |
ASSERT_TRUE(extension_dir.CreateUniqueTempDir()); |
- CommandLine command(CommandLine::NO_PROGRAM); |
+ Switches switches; |
std::vector<std::string> bg_pages; |
Status status = internal::ProcessExtensions(extensions, extension_dir.path(), |
- false, &command, &bg_pages); |
+ false, &switches, &bg_pages); |
ASSERT_TRUE(status.IsOk()); |
- ASSERT_TRUE(command.HasSwitch("load-extension")); |
- CommandLine::StringType ext_paths = command.GetSwitchValueNative( |
+ ASSERT_TRUE(switches.HasSwitch("load-extension")); |
+ CommandLine::StringType ext_paths = switches.GetSwitchValueNative( |
"load-extension"); |
std::vector<CommandLine::StringType> ext_path_list; |
base::SplitString(ext_paths, FILE_PATH_LITERAL(','), &ext_path_list); |
@@ -107,6 +107,24 @@ TEST(ProcessExtensions, MultipleExtensionsNoBgPages) { |
ASSERT_EQ(0u, bg_pages.size()); |
} |
+TEST(ProcessExtensions, CommandLineExtensions) { |
+ std::vector<std::string> extensions; |
+ ASSERT_TRUE(AddExtensionForInstall("ext_test_1.crx", &extensions)); |
+ base::ScopedTempDir extension_dir; |
+ ASSERT_TRUE(extension_dir.CreateUniqueTempDir()); |
+ |
+ Switches switches; |
+ switches.SetSwitch("load-extension", "/a"); |
+ std::vector<std::string> bg_pages; |
+ Status status = internal::ProcessExtensions(extensions, extension_dir.path(), |
+ false, &switches, &bg_pages); |
+ ASSERT_EQ(kOk, status.code()); |
+ base::FilePath::StringType load = switches.GetSwitchValueNative( |
+ "load-extension"); |
+ ASSERT_EQ(FILE_PATH_LITERAL("/a,"), load.substr(0, 3)); |
+ ASSERT_TRUE(base::PathExists(base::FilePath(load.substr(3)))); |
+} |
+ |
namespace { |
void AssertEQ(const base::DictionaryValue& dict, const std::string& key, |
@@ -122,7 +140,7 @@ TEST(PrepareUserDataDir, CustomPrefs) { |
base::ScopedTempDir temp_dir; |
ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
- CommandLine command(CommandLine::NO_PROGRAM); |
+ Switches switches; |
kkania
2013/08/30 03:14:57
?
|
base::DictionaryValue prefs; |
prefs.SetString("myPrefsKey", "ok"); |
prefs.SetStringWithoutPathExpansion("pref.sub", "1"); |