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

Side by Side Diff: chrome/browser/extensions/api/cookies/cookies_unittest.cc

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 years, 8 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 | Annotate | Revision Log
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 // Tests common functionality used by the Chrome Extensions Cookies API 5 // Tests common functionality used by the Chrome Extensions Cookies API
6 // implementation. 6 // implementation.
7 7
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 188
189 for (size_t i = 0; i < arraysize(tests); ++i) { 189 for (size_t i = 0; i < arraysize(tests); ++i) {
190 // Build up the Params struct. 190 // Build up the Params struct.
191 ListValue args; 191 ListValue args;
192 DictionaryValue* dict = new DictionaryValue(); 192 DictionaryValue* dict = new DictionaryValue();
193 dict->SetString(keys::kDomainKey, std::string(tests[i].filter)); 193 dict->SetString(keys::kDomainKey, std::string(tests[i].filter));
194 args.Set(0, dict); 194 args.Set(0, dict);
195 scoped_ptr<GetAll::Params> params(GetAll::Params::Create(args)); 195 scoped_ptr<GetAll::Params> params(GetAll::Params::Create(args));
196 196
197 cookies_helpers::MatchFilter filter(&params->details); 197 cookies_helpers::MatchFilter filter(&params->details);
198 net::CanonicalCookie cookie(GURL(), "", "", tests[i].domain,"", 198 net::CanonicalCookie cookie(GURL(),
199 base::Time(), base::Time(), base::Time(), 199 std::string(),
200 false, false); 200 std::string(),
201 tests[i].domain,
202 std::string(),
203 base::Time(),
204 base::Time(),
205 base::Time(),
206 false,
207 false);
201 EXPECT_EQ(tests[i].matches, filter.MatchesCookie(cookie)); 208 EXPECT_EQ(tests[i].matches, filter.MatchesCookie(cookie));
202 } 209 }
203 } 210 }
204 211
205 TEST_F(ExtensionCookiesTest, DecodeUTF8WithErrorHandling) { 212 TEST_F(ExtensionCookiesTest, DecodeUTF8WithErrorHandling) {
206 net::CanonicalCookie canonical_cookie( 213 net::CanonicalCookie canonical_cookie(GURL(),
207 GURL(), "", "011Q255bNX_1!yd\203e+", "test.com", "/path\203", 214 std::string(),
208 base::Time(), base::Time(), base::Time(), false, false); 215 "011Q255bNX_1!yd\203e+",
216 "test.com",
217 "/path\203",
218 base::Time(),
219 base::Time(),
220 base::Time(),
221 false,
222 false);
209 scoped_ptr<Cookie> cookie( 223 scoped_ptr<Cookie> cookie(
210 cookies_helpers::CreateCookie( 224 cookies_helpers::CreateCookie(
211 canonical_cookie, "some cookie store")); 225 canonical_cookie, "some cookie store"));
212 EXPECT_EQ(std::string("011Q255bNX_1!yd\xEF\xBF\xBD" "e+"), cookie->value); 226 EXPECT_EQ(std::string("011Q255bNX_1!yd\xEF\xBF\xBD" "e+"), cookie->value);
213 EXPECT_EQ(std::string(""), cookie->path); 227 EXPECT_EQ(std::string(), cookie->path);
214 } 228 }
215 229
216 } // namespace extensions 230 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698