summaryrefslogtreecommitdiffstats
path: root/chrome/common/net
diff options
context:
space:
mode:
authornkostylev@chromium.org <nkostylev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-06 15:44:14 +0000
committernkostylev@chromium.org <nkostylev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-06 15:44:14 +0000
commiteddc251ab1b451c20dbe81401268391edd79e974 (patch)
tree24e76701c5499033b0218af8a62d459956536f8c /chrome/common/net
parentae94021700004f768877bab12d2511691c073edb (diff)
downloadchromium_src-eddc251ab1b451c20dbe81401268391edd79e974.zip
chromium_src-eddc251ab1b451c20dbe81401268391edd79e974.tar.gz
chromium_src-eddc251ab1b451c20dbe81401268391edd79e974.tar.bz2
[cros] Use mocked URLFetcher and other mocks in ExistingUserController tests.
* Add MockLoginUtils + DoLaunchBrowser is not a static method any more. * Add MockUserManager * Added few missing basic expectation in MockDBusThreadManager Renaming of virtual getters/setters is done in http://codereview.chromium.org/9355059/ BUG=chromium-os:25926 TEST=ExistingUserController.ExistingUserLogin Review URL: https://chromiumcodereview.appspot.com/9348022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@125165 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/net')
-rw-r--r--chrome/common/net/gaia/gaia_auth_fetcher_unittest.cc7
-rw-r--r--chrome/common/net/gaia/mock_url_fetcher_factory.h (renamed from chrome/common/net/gaia/gaia_auth_fetcher_unittest.h)16
2 files changed, 11 insertions, 12 deletions
diff --git a/chrome/common/net/gaia/gaia_auth_fetcher_unittest.cc b/chrome/common/net/gaia/gaia_auth_fetcher_unittest.cc
index f62cfd8..8d3b4b0 100644
--- a/chrome/common/net/gaia/gaia_auth_fetcher_unittest.cc
+++ b/chrome/common/net/gaia/gaia_auth_fetcher_unittest.cc
@@ -5,8 +5,6 @@
// A complete set of unit tests for GaiaAuthFetcher.
// Originally ported from GoogleAuthenticator tests.
-#include "chrome/common/net/gaia/gaia_auth_fetcher_unittest.h"
-
#include <string>
#include "base/message_loop.h"
@@ -15,6 +13,7 @@
#include "chrome/common/net/gaia/gaia_auth_fetcher.h"
#include "chrome/common/net/gaia/gaia_urls.h"
#include "chrome/common/net/gaia/google_service_auth_error.h"
+#include "chrome/common/net/gaia/mock_url_fetcher_factory.h"
#include "chrome/test/base/testing_profile.h"
#include "content/public/common/url_fetcher_delegate.h"
#include "content/test/test_url_fetcher_factory.h"
@@ -482,7 +481,7 @@ TEST_F(GaiaAuthFetcherTest, FullLogin) {
TestingProfile profile;
- MockFactory<MockFetcher> factory;
+ MockURLFetcherFactory<MockFetcher> factory;
GaiaAuthFetcher auth(&consumer, std::string(),
profile_.GetRequestContext());
@@ -501,7 +500,7 @@ TEST_F(GaiaAuthFetcherTest, FullLoginFailure) {
TestingProfile profile;
- MockFactory<MockFetcher> factory;
+ MockURLFetcherFactory<MockFetcher> factory;
factory.set_success(false);
GaiaAuthFetcher auth(&consumer, std::string(),
diff --git a/chrome/common/net/gaia/gaia_auth_fetcher_unittest.h b/chrome/common/net/gaia/mock_url_fetcher_factory.h
index 9f6a7ba..6d88731 100644
--- a/chrome/common/net/gaia/gaia_auth_fetcher_unittest.h
+++ b/chrome/common/net/gaia/mock_url_fetcher_factory.h
@@ -5,8 +5,8 @@
// A collection of classes that are useful when testing things that use a
// GaiaAuthFetcher.
-#ifndef CHROME_COMMON_NET_GAIA_GAIA_AUTH_FETCHER_UNITTEST_H_
-#define CHROME_COMMON_NET_GAIA_GAIA_AUTH_FETCHER_UNITTEST_H_
+#ifndef CHROME_COMMON_NET_GAIA_MOCK_URL_FETCHER_FACTORY_H_
+#define CHROME_COMMON_NET_GAIA_MOCK_URL_FETCHER_FACTORY_H_
#pragma once
#include <string>
@@ -41,14 +41,14 @@ class MockFetcher : public TestURLFetcher {
};
template<typename T>
-class MockFactory : public content::URLFetcherFactory,
- public ScopedURLFetcherFactory {
+class MockURLFetcherFactory : public content::URLFetcherFactory,
+ public ScopedURLFetcherFactory {
public:
- MockFactory()
+ MockURLFetcherFactory()
: ScopedURLFetcherFactory(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
success_(true) {
}
- ~MockFactory() {}
+ ~MockURLFetcherFactory() {}
content::URLFetcher* CreateURLFetcher(
int id,
const GURL& url,
@@ -65,7 +65,7 @@ class MockFactory : public content::URLFetcherFactory,
private:
bool success_;
std::string results_;
- DISALLOW_COPY_AND_ASSIGN(MockFactory);
+ DISALLOW_COPY_AND_ASSIGN(MockURLFetcherFactory);
};
-#endif // CHROME_COMMON_NET_GAIA_GAIA_AUTH_FETCHER_UNITTEST_H_
+#endif // CHROME_COMMON_NET_GAIA_MOCK_URL_FETCHER_FACTORY_H_