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

Side by Side Diff: net/http/http_auth_handler_basic_unittest.cc

Issue 1800003: Auto-format style pass over files. (Closed)
Patch Set: Remove trailing whitespace. Created 10 years, 7 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
« no previous file with comments | « net/http/http_auth_cache.cc ('k') | net/http/http_auth_handler_digest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "testing/gtest/include/gtest/gtest.h" 5 #include "testing/gtest/include/gtest/gtest.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "net/base/net_errors.h" 8 #include "net/base/net_errors.h"
9 #include "net/http/http_auth_handler_basic.h" 9 #include "net/http/http_auth_handler_basic.h"
10 10
(...skipping 15 matching lines...) Expand all
26 }; 26 };
27 GURL origin("http://www.example.com"); 27 GURL origin("http://www.example.com");
28 HttpAuthHandlerBasic::Factory factory; 28 HttpAuthHandlerBasic::Factory factory;
29 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { 29 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
30 std::string challenge = "Basic realm=\"Atlantis\""; 30 std::string challenge = "Basic realm=\"Atlantis\"";
31 scoped_refptr<HttpAuthHandler> basic = new HttpAuthHandlerBasic; 31 scoped_refptr<HttpAuthHandler> basic = new HttpAuthHandlerBasic;
32 EXPECT_EQ(OK, factory.CreateAuthHandlerFromString( 32 EXPECT_EQ(OK, factory.CreateAuthHandlerFromString(
33 challenge, HttpAuth::AUTH_SERVER, origin, &basic)); 33 challenge, HttpAuth::AUTH_SERVER, origin, &basic));
34 std::string credentials; 34 std::string credentials;
35 int rv = basic->GenerateAuthToken(tests[i].username, 35 int rv = basic->GenerateAuthToken(tests[i].username,
36 tests[i].password, 36 tests[i].password,
37 NULL, 37 NULL,
38 NULL, 38 NULL,
39 &credentials); 39 &credentials);
40 EXPECT_EQ(OK, rv); 40 EXPECT_EQ(OK, rv);
41 EXPECT_STREQ(tests[i].expected_credentials, credentials.c_str()); 41 EXPECT_STREQ(tests[i].expected_credentials, credentials.c_str());
42 } 42 }
43 } 43 }
44 44
45 TEST(HttpAuthHandlerBasicTest, InitFromChallenge) { 45 TEST(HttpAuthHandlerBasicTest, InitFromChallenge) {
46 static const struct { 46 static const struct {
47 const char* challenge; 47 const char* challenge;
48 int expected_rv; 48 int expected_rv;
49 const char* expected_realm; 49 const char* expected_realm;
(...skipping 20 matching lines...) Expand all
70 scoped_refptr<HttpAuthHandler> basic = new HttpAuthHandlerBasic; 70 scoped_refptr<HttpAuthHandler> basic = new HttpAuthHandlerBasic;
71 int rv = factory.CreateAuthHandlerFromString( 71 int rv = factory.CreateAuthHandlerFromString(
72 challenge, HttpAuth::AUTH_SERVER, origin, &basic); 72 challenge, HttpAuth::AUTH_SERVER, origin, &basic);
73 EXPECT_EQ(tests[i].expected_rv, rv); 73 EXPECT_EQ(tests[i].expected_rv, rv);
74 if (rv == OK) 74 if (rv == OK)
75 EXPECT_EQ(tests[i].expected_realm, basic->realm()); 75 EXPECT_EQ(tests[i].expected_realm, basic->realm());
76 } 76 }
77 } 77 }
78 78
79 } // namespace net 79 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_auth_cache.cc ('k') | net/http/http_auth_handler_digest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698