summaryrefslogtreecommitdiffstats
path: root/chrome/test/sync/engine
diff options
context:
space:
mode:
authorerg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-11 20:44:42 +0000
committererg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-11 20:44:42 +0000
commit5322a7f16a374a15fe69b3bb2621678aede48bca (patch)
tree56c8ee955ed32cd69f8b3395cb609dcdd504e58c /chrome/test/sync/engine
parent192a05f2e4d8f66d095227439d4dce7bb14b16b5 (diff)
downloadchromium_src-5322a7f16a374a15fe69b3bb2621678aede48bca.zip
chromium_src-5322a7f16a374a15fe69b3bb2621678aede48bca.tar.gz
chromium_src-5322a7f16a374a15fe69b3bb2621678aede48bca.tar.bz2
Continuing with the out-of-lining of test code.
BUG=none TEST=compiles Review URL: http://codereview.chromium.org/6485015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74660 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/sync/engine')
-rw-r--r--chrome/test/sync/engine/mock_gaia_authenticator.cc42
-rw-r--r--chrome/test/sync/engine/mock_gaia_authenticator.h48
2 files changed, 51 insertions, 39 deletions
diff --git a/chrome/test/sync/engine/mock_gaia_authenticator.cc b/chrome/test/sync/engine/mock_gaia_authenticator.cc
index ebcf566..75d4f97 100644
--- a/chrome/test/sync/engine/mock_gaia_authenticator.cc
+++ b/chrome/test/sync/engine/mock_gaia_authenticator.cc
@@ -21,6 +21,8 @@ MockGaiaAuthenticator::MockGaiaAuthenticator(const char* user_agent,
// doesn't care about them.
}
+MockGaiaAuthenticator::~MockGaiaAuthenticator() {}
+
// Add a mock user to internal list of users.
void MockGaiaAuthenticator::AddMockUser(MockUser mock_user) {
mock_credentials_[mock_user.email] = mock_user;
@@ -107,4 +109,44 @@ void MockGaiaAuthenticator::ResetCredentials() {
current_user_ = "";
}
+std::string MockGaiaAuthenticator::email() {
+ return (current_user_.empty() || !should_save_credentials_) ? "" :
+ mock_credentials_[current_user_].email;
+}
+
+std::string MockGaiaAuthenticator::auth_token() {
+ return (current_user_.empty()) ? "" :
+ mock_credentials_[current_user_].auth_token;
+}
+
+std::string MockGaiaAuthenticator::sid() {
+ return (current_user_.empty()) ? "" :
+ mock_credentials_[current_user_].sid;
+}
+
+std::string MockGaiaAuthenticator::lsid() {
+ return (current_user_.empty()) ? "" :
+ mock_credentials_[current_user_].lsid;
+}
+
+gaia::AuthenticationError MockGaiaAuthenticator::auth_error() {
+ return (current_user_.empty()) ? gaia::CredentialsNotSet :
+ mock_credentials_[current_user_].auth_error;
+}
+
+std::string MockGaiaAuthenticator::auth_error_url() {
+ return (current_user_.empty()) ? "" :
+ mock_credentials_[current_user_].error_url;
+}
+
+std::string MockGaiaAuthenticator::captcha_token() {
+ return (current_user_.empty()) ? "" :
+ mock_credentials_[current_user_].captcha_token;
+}
+
+std::string MockGaiaAuthenticator::captcha_url() {
+ return (current_user_.empty()) ? "" :
+ mock_credentials_[current_user_].captcha_url;
+}
+
} // namespace browser_sync
diff --git a/chrome/test/sync/engine/mock_gaia_authenticator.h b/chrome/test/sync/engine/mock_gaia_authenticator.h
index e882e9b..07291bf 100644
--- a/chrome/test/sync/engine/mock_gaia_authenticator.h
+++ b/chrome/test/sync/engine/mock_gaia_authenticator.h
@@ -57,6 +57,7 @@ class MockGaiaAuthenticator {
public:
MockGaiaAuthenticator(const char* user_agent, const char* service_id,
const char* gaia_url);
+ ~MockGaiaAuthenticator();
// Add a mock user; takes a struct. You can populate any or all fields when
// adding a user. The email field is required, all others optional.
@@ -96,45 +97,14 @@ class MockGaiaAuthenticator {
void ResetCredentials();
// Accessors follow.
- std::string email() {
- return (current_user_.length() == 0 || !should_save_credentials_) ? "" :
- mock_credentials_[current_user_].email;
- }
-
- std::string auth_token() {
- return (current_user_.length() == 0) ? "" :
- mock_credentials_[current_user_].auth_token;
- }
-
- std::string sid() {
- return (current_user_.length() == 0) ? "" :
- mock_credentials_[current_user_].sid;
- }
-
- std::string lsid() {
- return (current_user_.length() == 0) ? "" :
- mock_credentials_[current_user_].lsid;
- }
-
- gaia::AuthenticationError auth_error() {
- return (current_user_.length() == 0) ? gaia::CredentialsNotSet :
- mock_credentials_[current_user_].auth_error;
- }
-
- std::string auth_error_url() {
- return (current_user_.length() == 0) ? "" :
- mock_credentials_[current_user_].error_url;
- }
-
- std::string captcha_token() {
- return (current_user_.length() == 0) ? "" :
- mock_credentials_[current_user_].captcha_token;
- }
-
- std::string captcha_url() {
- return (current_user_.length() == 0) ? "" :
- mock_credentials_[current_user_].captcha_url;
- }
+ std::string email();
+ std::string auth_token();
+ std::string sid();
+ std::string lsid();
+ gaia::AuthenticationError auth_error();
+ std::string auth_error_url();
+ std::string captcha_token();
+ std::string captcha_url();
private:
bool should_save_credentials_;