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

Side by Side Diff: extensions/common/permissions/permission_message_test_util.cc

Issue 1223153003: Move JoinString to the base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: windows 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "extensions/common/permissions/permission_message_test_util.h" 5 #include "extensions/common/permissions/permission_message_test_util.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 9
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 return result; 95 return result;
96 } 96 }
97 97
98 // Returns the vector of messages concatenated into a single string, separated 98 // Returns the vector of messages concatenated into a single string, separated
99 // by newlines, e.g.: "Bar"\n"Baz"\n 99 // by newlines, e.g.: "Bar"\n"Baz"\n
100 base::string16 MessagesVectorToString( 100 base::string16 MessagesVectorToString(
101 const std::vector<base::string16>& messages) { 101 const std::vector<base::string16>& messages) {
102 if (messages.empty()) 102 if (messages.empty())
103 return base::ASCIIToUTF16("\n"); 103 return base::ASCIIToUTF16("\n");
104 return base::ASCIIToUTF16("\"") + 104 return base::ASCIIToUTF16("\"") +
105 JoinString(messages, base::ASCIIToUTF16("\"\n\"")) + 105 base::JoinString(messages, base::ASCIIToUTF16("\"\n\"")) +
106 base::ASCIIToUTF16("\"\n"); 106 base::ASCIIToUTF16("\"\n");
107 } 107 }
108 108
109 base::string16 MessagesToString(const PermissionMessageStrings& messages) { 109 base::string16 MessagesToString(const PermissionMessageStrings& messages) {
110 std::vector<base::string16> messages_vec; 110 std::vector<base::string16> messages_vec;
111 for (const PermissionMessageString& msg : messages) 111 for (const PermissionMessageString& msg : messages)
112 messages_vec.push_back(msg.message); 112 messages_vec.push_back(msg.message);
113 return MessagesVectorToString(messages_vec); 113 return MessagesVectorToString(messages_vec);
114 } 114 }
115 115
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 for (size_t i = 0; i < expected_messages.size(); i++) { 405 for (size_t i = 0; i < expected_messages.size(); i++) {
406 expected.push_back(PermissionMessageString(expected_messages[i], 406 expected.push_back(PermissionMessageString(expected_messages[i],
407 expected_submessages[i])); 407 expected_submessages[i]));
408 } 408 }
409 return VerifyPermissionMessagesWithSubmessagesImpl( 409 return VerifyPermissionMessagesWithSubmessagesImpl(
410 expected, GetLegacyMessages(permissions_data), 410 expected, GetLegacyMessages(permissions_data),
411 GetNewMessages(permissions_data), check_order); 411 GetNewMessages(permissions_data), check_order);
412 } 412 }
413 413
414 } // namespace extensions 414 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/features/base_feature_provider.cc ('k') | extensions/common/permissions/socket_permission_entry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698