summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authordavemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-22 01:27:37 +0000
committerdavemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-22 01:27:37 +0000
commit429e3652788bc6a49da69bc767661a68f63260a7 (patch)
treefe750b848ca8c20f7dfa9d10e3c4c03900119657 /chrome
parent0a126223a953345b09464fcc95631a96fad35315 (diff)
downloadchromium_src-429e3652788bc6a49da69bc767661a68f63260a7.zip
chromium_src-429e3652788bc6a49da69bc767661a68f63260a7.tar.gz
chromium_src-429e3652788bc6a49da69bc767661a68f63260a7.tar.bz2
Remove unnecessary cookie delegate and test expectations
Fixes unit test failures TBR: cmasone@chromium.org BUG=None TEST=None Review URL: http://codereview.chromium.org/4073001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63472 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/chromeos/login/cookie_fetcher.cc10
-rw-r--r--chrome/browser/chromeos/login/cookie_fetcher.h27
-rw-r--r--chrome/browser/chromeos/login/cookie_fetcher_unittest.cc39
3 files changed, 7 insertions, 69 deletions
diff --git a/chrome/browser/chromeos/login/cookie_fetcher.cc b/chrome/browser/chromeos/login/cookie_fetcher.cc
index d157de9..d73d8da 100644
--- a/chrome/browser/chromeos/login/cookie_fetcher.cc
+++ b/chrome/browser/chromeos/login/cookie_fetcher.cc
@@ -26,7 +26,6 @@ CookieFetcher::CookieFetcher(Profile* profile) : profile_(profile) {
new ClientLoginResponseHandler(profile_->GetRequestContext()));
issue_handler_.reset(
new IssueResponseHandler(profile_->GetRequestContext()));
- launcher_.reset(new DelegateImpl);
}
void CookieFetcher::AttemptFetch(const std::string& credentials) {
@@ -51,13 +50,4 @@ void CookieFetcher::OnURLFetchComplete(const URLFetcher* source,
delete this;
}
-void CookieFetcher::DelegateImpl::DoLaunch(Profile* profile) {
- if (profile == ProfileManager::GetDefaultProfile()) {
- LoginUtils::DoBrowserLaunch(profile);
- } else {
- LOG(ERROR) <<
- "Profile has changed since we started populating it with cookies";
- }
-}
-
} // namespace chromeos
diff --git a/chrome/browser/chromeos/login/cookie_fetcher.h b/chrome/browser/chromeos/login/cookie_fetcher.h
index 4c6d66a..45a20c7 100644
--- a/chrome/browser/chromeos/login/cookie_fetcher.h
+++ b/chrome/browser/chromeos/login/cookie_fetcher.h
@@ -23,17 +23,6 @@ namespace chromeos {
// done attempting to fetch URLs.
class CookieFetcher : public URLFetcher::Delegate {
public:
- // This class is a very thin wrapper around posting a task to the UI thread
- // to call LoginUtils::DoBrowserLaunch(). It's here to allow mocking.
- //
- // In normal usage, instances of this class are owned by a CookieFetcher.
- class Delegate {
- public:
- Delegate() {}
- virtual ~Delegate() {}
- virtual void DoLaunch(Profile* profile) = 0;
- };
-
// |profile| is the Profile whose cookie jar you want the cookies in.
explicit CookieFetcher(Profile* profile);
@@ -41,12 +30,10 @@ class CookieFetcher : public URLFetcher::Delegate {
// Takes ownership of |cl_handler|, |i_handler|, and |launcher|.
CookieFetcher(Profile* profile,
AuthResponseHandler* cl_handler,
- AuthResponseHandler* i_handler,
- Delegate* launcher)
+ AuthResponseHandler* i_handler)
: profile_(profile),
client_login_handler_(cl_handler),
- issue_handler_(i_handler),
- launcher_(launcher) {
+ issue_handler_(i_handler) {
}
// Given a newline-delineated SID/LSID pair of Google cookies (like
@@ -65,22 +52,12 @@ class CookieFetcher : public URLFetcher::Delegate {
const std::string& data);
private:
- class DelegateImpl : public Delegate {
- public:
- DelegateImpl() {}
- ~DelegateImpl() {}
- void DoLaunch(Profile* profile);
- private:
- DISALLOW_COPY_AND_ASSIGN(DelegateImpl);
- };
-
virtual ~CookieFetcher() {}
scoped_ptr<URLFetcher> fetcher_;
Profile* profile_;
scoped_ptr<AuthResponseHandler> client_login_handler_;
scoped_ptr<AuthResponseHandler> issue_handler_;
- scoped_ptr<Delegate> launcher_;
DISALLOW_COPY_AND_ASSIGN(CookieFetcher);
};
diff --git a/chrome/browser/chromeos/login/cookie_fetcher_unittest.cc b/chrome/browser/chromeos/login/cookie_fetcher_unittest.cc
index e274f64..832c877 100644
--- a/chrome/browser/chromeos/login/cookie_fetcher_unittest.cc
+++ b/chrome/browser/chromeos/login/cookie_fetcher_unittest.cc
@@ -23,13 +23,6 @@ using ::testing::Invoke;
using ::testing::Unused;
using ::testing::_;
-class MockDelegate : public CookieFetcher::Delegate {
- public:
- MockDelegate() {}
- virtual ~MockDelegate() {}
- MOCK_METHOD1(DoLaunch, void(Profile* profile));
-};
-
class CookieFetcherTest : public ::testing::Test {
public:
CookieFetcherTest()
@@ -58,9 +51,8 @@ TEST_F(CookieFetcherTest, SuccessfulFetchTest) {
new MockAuthResponseHandler(iat_url_, status, kHttpSuccess, token_);
MockAuthResponseHandler* i_handler =
new MockAuthResponseHandler(ta_url_, status, kHttpSuccess, std::string());
- MockDelegate* delegate = new MockDelegate;
- CookieFetcher* cf = new CookieFetcher(NULL, cl_handler, i_handler, delegate);
+ CookieFetcher* cf = new CookieFetcher(NULL, cl_handler, i_handler);
EXPECT_CALL(*cl_handler, Handle(client_login_data_, cf))
.Times(1);
@@ -72,9 +64,6 @@ TEST_F(CookieFetcherTest, SuccessfulFetchTest) {
EXPECT_CALL(*i_handler, Handle(token_, cf))
.Times(1);
- EXPECT_CALL(*delegate, DoLaunch(_))
- .Times(1);
-
cf->AttemptFetch(client_login_data_);
message_loop_.RunAllPending();
}
@@ -86,20 +75,16 @@ TEST_F(CookieFetcherTest, IssueAuthTokenNetworkFailureTest) {
MockAuthResponseHandler* cl_handler =
new MockAuthResponseHandler(iat_url_, failed, kHttpSuccess, token_);
- MockDelegate* delegate = new MockDelegate;
// I expect nothing in i_handler to get called anyway
MockAuthResponseHandler* i_handler =
new MockAuthResponseHandler(ta_url_, failed, kHttpSuccess, std::string());
CookieFetcher* cf = new CookieFetcher(&profile_,
cl_handler,
- i_handler,
- delegate);
+ i_handler);
EXPECT_CALL(*cl_handler, Handle(client_login_data_, cf))
.Times(1);
- EXPECT_CALL(*delegate, DoLaunch(_))
- .Times(1);
cf->AttemptFetch(client_login_data_);
message_loop_.RunAllPending();
@@ -115,12 +100,10 @@ TEST_F(CookieFetcherTest, TokenAuthNetworkFailureTest) {
new MockAuthResponseHandler(iat_url_, success, kHttpSuccess, token_);
MockAuthResponseHandler* i_handler =
new MockAuthResponseHandler(ta_url_, failed, 0, std::string());
- MockDelegate* delegate = new MockDelegate;
CookieFetcher* cf = new CookieFetcher(&profile_,
cl_handler,
- i_handler,
- delegate);
+ i_handler);
EXPECT_CALL(*cl_handler, Handle(client_login_data_, cf))
.Times(1);
@@ -130,9 +113,6 @@ TEST_F(CookieFetcherTest, TokenAuthNetworkFailureTest) {
EXPECT_CALL(*i_handler, Handle(token_, cf))
.Times(1);
- EXPECT_CALL(*delegate, DoLaunch(_))
- .Times(1);
-
cf->AttemptFetch(client_login_data_);
message_loop_.RunAllPending();
}
@@ -144,20 +124,16 @@ TEST_F(CookieFetcherTest, IssueAuthTokenDeniedTest) {
MockAuthResponseHandler* cl_handler =
new MockAuthResponseHandler(iat_url_, success, 403, std::string());
- MockDelegate* delegate = new MockDelegate;
// I expect nothing in i_handler to get called anyway.
MockAuthResponseHandler* i_handler =
new MockAuthResponseHandler(ta_url_, success, 0, std::string());
CookieFetcher* cf = new CookieFetcher(&profile_,
cl_handler,
- i_handler,
- delegate);
+ i_handler);
EXPECT_CALL(*cl_handler, Handle(client_login_data_, cf))
.Times(1);
- EXPECT_CALL(*delegate, DoLaunch(_))
- .Times(1);
cf->AttemptFetch(client_login_data_);
message_loop_.RunAllPending();
@@ -175,12 +151,10 @@ TEST_F(CookieFetcherTest, TokenAuthDeniedTest) {
token_);
MockAuthResponseHandler* i_handler =
new MockAuthResponseHandler(ta_url_, success, 403, std::string());
- MockDelegate* delegate = new MockDelegate;
CookieFetcher* cf = new CookieFetcher(&profile_,
cl_handler,
- i_handler,
- delegate);
+ i_handler);
EXPECT_CALL(*cl_handler, Handle(client_login_data_, cf))
.Times(1);
@@ -190,9 +164,6 @@ TEST_F(CookieFetcherTest, TokenAuthDeniedTest) {
EXPECT_CALL(*i_handler, Handle(token_, cf))
.Times(1);
- EXPECT_CALL(*delegate, DoLaunch(_))
- .Times(1);
-
cf->AttemptFetch(client_login_data_);
message_loop_.RunAllPending();
}