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

Side by Side Diff: chrome/test/chromedriver/chrome_launcher_unittest.cc

Issue 1240183002: Update SplitString calls in chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/base64.h" 5 #include "base/base64.h"
6 #include "base/base_paths.h" 6 #include "base/base_paths.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 ASSERT_TRUE(extension_dir.CreateUniqueTempDir()); 117 ASSERT_TRUE(extension_dir.CreateUniqueTempDir());
118 118
119 Switches switches; 119 Switches switches;
120 std::vector<std::string> bg_pages; 120 std::vector<std::string> bg_pages;
121 Status status = internal::ProcessExtensions(extensions, extension_dir.path(), 121 Status status = internal::ProcessExtensions(extensions, extension_dir.path(),
122 false, &switches, &bg_pages); 122 false, &switches, &bg_pages);
123 ASSERT_TRUE(status.IsOk()); 123 ASSERT_TRUE(status.IsOk());
124 ASSERT_TRUE(switches.HasSwitch("load-extension")); 124 ASSERT_TRUE(switches.HasSwitch("load-extension"));
125 base::CommandLine::StringType ext_paths = 125 base::CommandLine::StringType ext_paths =
126 switches.GetSwitchValueNative("load-extension"); 126 switches.GetSwitchValueNative("load-extension");
127 std::vector<base::CommandLine::StringType> ext_path_list; 127 std::vector<base::CommandLine::StringType> ext_path_list =
128 base::SplitString(ext_paths, FILE_PATH_LITERAL(','), &ext_path_list); 128 base::SplitString(ext_paths, base::CommandLine::StringType(1, ','),
129 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
129 ASSERT_EQ(2u, ext_path_list.size()); 130 ASSERT_EQ(2u, ext_path_list.size());
130 ASSERT_TRUE(base::PathExists(base::FilePath(ext_path_list[0]))); 131 ASSERT_TRUE(base::PathExists(base::FilePath(ext_path_list[0])));
131 ASSERT_TRUE(base::PathExists(base::FilePath(ext_path_list[1]))); 132 ASSERT_TRUE(base::PathExists(base::FilePath(ext_path_list[1])));
132 ASSERT_EQ(0u, bg_pages.size()); 133 ASSERT_EQ(0u, bg_pages.size());
133 } 134 }
134 135
135 TEST(ProcessExtensions, CommandLineExtensions) { 136 TEST(ProcessExtensions, CommandLineExtensions) {
136 std::vector<std::string> extensions; 137 std::vector<std::string> extensions;
137 ASSERT_TRUE(AddExtensionForInstall("ext_test_1.crx", &extensions)); 138 ASSERT_TRUE(AddExtensionForInstall("ext_test_1.crx", &extensions));
138 base::ScopedTempDir extension_dir; 139 base::ScopedTempDir extension_dir;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 temp_dir.path().Append(chrome::kLocalStateFilename); 191 temp_dir.path().Append(chrome::kLocalStateFilename);
191 std::string local_state_str; 192 std::string local_state_str;
192 ASSERT_TRUE(base::ReadFileToString(local_state_file, &local_state_str)); 193 ASSERT_TRUE(base::ReadFileToString(local_state_file, &local_state_str));
193 scoped_ptr<base::Value> local_state_value( 194 scoped_ptr<base::Value> local_state_value(
194 base::JSONReader::DeprecatedRead(local_state_str)); 195 base::JSONReader::DeprecatedRead(local_state_str));
195 const base::DictionaryValue* local_state_dict = NULL; 196 const base::DictionaryValue* local_state_dict = NULL;
196 ASSERT_TRUE(local_state_value->GetAsDictionary(&local_state_dict)); 197 ASSERT_TRUE(local_state_value->GetAsDictionary(&local_state_dict));
197 AssertEQ(*local_state_dict, "myLocalKey", "ok"); 198 AssertEQ(*local_state_dict, "myLocalKey", "ok");
198 AssertEQ(*local_state_dict, "local.state.sub", "2"); 199 AssertEQ(*local_state_dict, "local.state.sub", "2");
199 } 200 }
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/chrome/chrome_android_impl.cc ('k') | chrome/test/chromedriver/element_commands.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698