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

Side by Side Diff: chrome/browser/extensions/extension_apitest.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/extensions/extension_apitest.h" 5 #include "chrome/browser/extensions/extension_apitest.h"
6 6
7 #include "base/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/strings/string_split.h" 8 #include "base/strings/string_split.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 return nullptr; 87 return nullptr;
88 88
89 scoped_ptr<net::test_server::BasicHttpResponse> http_response( 89 scoped_ptr<net::test_server::BasicHttpResponse> http_response(
90 new net::test_server::BasicHttpResponse); 90 new net::test_server::BasicHttpResponse);
91 http_response->set_code(net::HTTP_OK); 91 http_response->set_code(net::HTTP_OK);
92 92
93 size_t query_string_pos = request.relative_url.find('?'); 93 size_t query_string_pos = request.relative_url.find('?');
94 std::string cookie_value = 94 std::string cookie_value =
95 request.relative_url.substr(query_string_pos + 1); 95 request.relative_url.substr(query_string_pos + 1);
96 96
97 std::vector<std::string> cookies; 97 for (const std::string& cookie : base::SplitString(
98 base::SplitString(cookie_value, '&', &cookies); 98 cookie_value, "&", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL))
99 99 http_response->AddCustomHeader("Set-Cookie", cookie);
100 for (size_t i = 0; i < cookies.size(); i++)
101 http_response->AddCustomHeader("Set-Cookie", cookies[i]);
102 100
103 return http_response.Pass(); 101 return http_response.Pass();
104 } 102 }
105 103
106 scoped_ptr<net::test_server::HttpResponse> HandleSetHeaderRequest( 104 scoped_ptr<net::test_server::HttpResponse> HandleSetHeaderRequest(
107 const net::test_server::HttpRequest& request) { 105 const net::test_server::HttpRequest& request) {
108 if (!base::StartsWith(request.relative_url, "/set-header?", 106 if (!base::StartsWith(request.relative_url, "/set-header?",
109 base::CompareCase::SENSITIVE)) 107 base::CompareCase::SENSITIVE))
110 return nullptr; 108 return nullptr;
111 109
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 } 427 }
430 428
431 void ExtensionApiTest::SetUpCommandLine(base::CommandLine* command_line) { 429 void ExtensionApiTest::SetUpCommandLine(base::CommandLine* command_line) {
432 ExtensionBrowserTest::SetUpCommandLine(command_line); 430 ExtensionBrowserTest::SetUpCommandLine(command_line);
433 test_data_dir_ = test_data_dir_.AppendASCII("api_test"); 431 test_data_dir_ = test_data_dir_.AppendASCII("api_test");
434 // Backgrounded renderer processes run at a lower priority, causing the 432 // Backgrounded renderer processes run at a lower priority, causing the
435 // tests to take more time to complete. Disable backgrounding so that the 433 // tests to take more time to complete. Disable backgrounding so that the
436 // tests don't time out. 434 // tests don't time out.
437 command_line->AppendSwitch(switches::kDisableRendererBackgrounding); 435 command_line->AppendSwitch(switches::kDisableRendererBackgrounding);
438 } 436 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/log_private/log_parser.cc ('k') | chrome/browser/extensions/install_signer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698