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

Side by Side Diff: chrome/browser/sync/engine/net/gaia_authenticator_unittest.cc

Issue 273058: Fix some warnings on Mac that are treated as errors:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/sync/engine/net/gaia_authenticator.h" 5 #include "chrome/browser/sync/engine/net/gaia_authenticator.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "chrome/browser/sync/engine/net/http_return.h" 9 #include "chrome/browser/sync/engine/net/http_return.h"
10 #include "chrome/browser/sync/util/sync_types.h" 10 #include "chrome/browser/sync/util/sync_types.h"
11 #include "googleurl/src/gurl.h" 11 #include "googleurl/src/gurl.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 13
14 using std::string; 14 using std::string;
15 15
16 namespace browser_sync { 16 namespace browser_sync {
17 17
18 class GaiaAuthenticatorTest : public testing::Test { }; 18 class GaiaAuthenticatorTest : public testing::Test { };
19 19
20 class GaiaAuthMock : public GaiaAuthenticator { 20 class GaiaAuthMockForGaiaAuthenticator : public GaiaAuthenticator {
21 public: 21 public:
22 GaiaAuthMock() : GaiaAuthenticator("useragent", 22 GaiaAuthMockForGaiaAuthenticator()
23 "serviceid", 23 : GaiaAuthenticator("useragent", "serviceid", "http://gaia_url") {}
24 "http://gaia_url") {} 24 ~GaiaAuthMockForGaiaAuthenticator() {}
25 ~GaiaAuthMock() {}
26 protected: 25 protected:
27 bool Post(const GURL& url, const string& post_body, 26 bool Post(const GURL& url, const string& post_body,
28 unsigned long* response_code, string* response_body) { 27 unsigned long* response_code, string* response_body) {
29 *response_code = RC_REQUEST_OK; 28 *response_code = RC_REQUEST_OK;
30 response_body->assign("body\n"); 29 response_body->assign("body\n");
31 return true; 30 return true;
32 } 31 }
33 }; 32 };
34 33
35 TEST(GaiaAuthenticatorTest, TestNewlineAtEndOfAuthTokenRemoved) { 34 TEST(GaiaAuthenticatorTest, TestNewlineAtEndOfAuthTokenRemoved) {
36 GaiaAuthMock mock_auth; 35 GaiaAuthMockForGaiaAuthenticator mock_auth;
37 MessageLoop message_loop; 36 MessageLoop message_loop;
38 mock_auth.set_message_loop(&message_loop); 37 mock_auth.set_message_loop(&message_loop);
39 GaiaAuthenticator::AuthResults results; 38 GaiaAuthenticator::AuthResults results;
40 EXPECT_TRUE(mock_auth.IssueAuthToken(&results, "sid", true)); 39 EXPECT_TRUE(mock_auth.IssueAuthToken(&results, "sid", true));
41 EXPECT_EQ(0, results.auth_token.compare("body")); 40 EXPECT_EQ(0, results.auth_token.compare("body"));
42 } 41 }
43 42
44 } // namespace browser_sync 43 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698