Commit 2c354769 authored by munjal@chromium.org's avatar munjal@chromium.org

Fix some oauth2 test code: put most code in anonymous namespace to avoid

ODR violations.
Review URL: https://chromiumcodereview.appspot.com/10389220

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137987 0039d316-1c4b-4281-b951-d872f2087c98
parent dac48051
...@@ -35,6 +35,7 @@ using testing::_; ...@@ -35,6 +35,7 @@ using testing::_;
using testing::Return; using testing::Return;
namespace { namespace {
typedef std::vector<std::string> ScopeList; typedef std::vector<std::string> ScopeList;
static const char kValidTokenResponse[] = static const char kValidTokenResponse[] =
...@@ -48,7 +49,6 @@ static const char kTokenResponseNoAccessToken[] = ...@@ -48,7 +49,6 @@ static const char kTokenResponseNoAccessToken[] =
" \"expires_in\": 3600," " \"expires_in\": 3600,"
" \"token_type\": \"Bearer\"" " \"token_type\": \"Bearer\""
"}"; "}";
}
class MockUrlFetcherFactory : public ScopedURLFetcherFactory, class MockUrlFetcherFactory : public ScopedURLFetcherFactory,
public URLFetcherFactory { public URLFetcherFactory {
...@@ -76,6 +76,8 @@ class MockOAuth2AccessTokenConsumer : public OAuth2AccessTokenConsumer { ...@@ -76,6 +76,8 @@ class MockOAuth2AccessTokenConsumer : public OAuth2AccessTokenConsumer {
void(const GoogleServiceAuthError& error)); void(const GoogleServiceAuthError& error));
}; };
} // namespace
class OAuth2AccessTokenFetcherTest : public testing::Test { class OAuth2AccessTokenFetcherTest : public testing::Test {
public: public:
OAuth2AccessTokenFetcherTest() OAuth2AccessTokenFetcherTest()
......
...@@ -34,6 +34,7 @@ using testing::_; ...@@ -34,6 +34,7 @@ using testing::_;
using testing::Return; using testing::Return;
namespace { namespace {
static std::string CreateBody() { static std::string CreateBody() {
return "some body"; return "some body";
} }
...@@ -49,8 +50,6 @@ static std::vector<std::string> CreateTestScopes() { ...@@ -49,8 +50,6 @@ static std::vector<std::string> CreateTestScopes() {
return scopes; return scopes;
} }
} // namespace
class MockUrlFetcherFactory : public ScopedURLFetcherFactory, class MockUrlFetcherFactory : public ScopedURLFetcherFactory,
public URLFetcherFactory { public URLFetcherFactory {
public: public:
...@@ -103,6 +102,8 @@ class MockApiCallFlow : public OAuth2ApiCallFlow { ...@@ -103,6 +102,8 @@ class MockApiCallFlow : public OAuth2ApiCallFlow {
MOCK_METHOD0(CreateAccessTokenFetcher, OAuth2AccessTokenFetcher* ()); MOCK_METHOD0(CreateAccessTokenFetcher, OAuth2AccessTokenFetcher* ());
}; };
} // namespace
class OAuth2ApiCallFlowTest : public testing::Test { class OAuth2ApiCallFlowTest : public testing::Test {
public: public:
OAuth2ApiCallFlowTest() {} OAuth2ApiCallFlowTest() {}
......
...@@ -36,6 +36,7 @@ using testing::_; ...@@ -36,6 +36,7 @@ using testing::_;
using testing::Return; using testing::Return;
namespace { namespace {
static const char kValidTokenResponse[] = static const char kValidTokenResponse[] =
"{" "{"
" \"token\": \"at1\"," " \"token\": \"at1\","
...@@ -45,7 +46,6 @@ static const char kTokenResponseNoAccessToken[] = ...@@ -45,7 +46,6 @@ static const char kTokenResponseNoAccessToken[] =
"{" "{"
" \"issueAdvice\": \"Auto\"" " \"issueAdvice\": \"Auto\""
"}"; "}";
}
class MockUrlFetcherFactory : public ScopedURLFetcherFactory, class MockUrlFetcherFactory : public ScopedURLFetcherFactory,
public URLFetcherFactory { public URLFetcherFactory {
...@@ -73,6 +73,8 @@ class MockOAuth2MintTokenConsumer : public OAuth2MintTokenConsumer { ...@@ -73,6 +73,8 @@ class MockOAuth2MintTokenConsumer : public OAuth2MintTokenConsumer {
void(const GoogleServiceAuthError& error)); void(const GoogleServiceAuthError& error));
}; };
} // namespace
class OAuth2MintTokenFetcherTest : public testing::Test { class OAuth2MintTokenFetcherTest : public testing::Test {
public: public:
OAuth2MintTokenFetcherTest() OAuth2MintTokenFetcherTest()
......
...@@ -119,8 +119,6 @@ static IssueAdviceInfo CreateIssueAdvice() { ...@@ -119,8 +119,6 @@ static IssueAdviceInfo CreateIssueAdvice() {
return ia; return ia;
} }
} // namespace
class MockDelegate : public OAuth2MintTokenFlow::Delegate { class MockDelegate : public OAuth2MintTokenFlow::Delegate {
public: public:
MockDelegate() {} MockDelegate() {}
...@@ -144,6 +142,8 @@ class MockMintTokenFlow : public OAuth2MintTokenFlow { ...@@ -144,6 +142,8 @@ class MockMintTokenFlow : public OAuth2MintTokenFlow {
MOCK_METHOD0(CreateMintTokenFetcher, OAuth2MintTokenFetcher*()); MOCK_METHOD0(CreateMintTokenFetcher, OAuth2MintTokenFetcher*());
}; };
} // namespace
class OAuth2MintTokenFlowTest : public testing::Test { class OAuth2MintTokenFlowTest : public testing::Test {
public: public:
OAuth2MintTokenFlowTest() {} OAuth2MintTokenFlowTest() {}
......
...@@ -62,7 +62,7 @@ class MockOAuth2RevocationConsumer : public OAuth2RevocationConsumer { ...@@ -62,7 +62,7 @@ class MockOAuth2RevocationConsumer : public OAuth2RevocationConsumer {
void(const GoogleServiceAuthError& error)); void(const GoogleServiceAuthError& error));
}; };
} } // namespace
class OAuth2RevocationFetcherTest : public testing::Test { class OAuth2RevocationFetcherTest : public testing::Test {
public: public:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment