diff options
author | msw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-10 22:56:01 +0000 |
---|---|---|
committer | msw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-10 22:56:01 +0000 |
commit | dff69fd38aa755ecd8ddd9348fbade0827d780ad (patch) | |
tree | 425ce1ad91ce5c174baaf4127b3e127c93b46648 /chrome/browser/chrome_to_mobile_service_unittest.cc | |
parent | 1a23d36a9ffa591b56a2fc0826b92d19904bfa34 (diff) | |
download | chromium_src-dff69fd38aa755ecd8ddd9348fbade0827d780ad.zip chromium_src-dff69fd38aa755ecd8ddd9348fbade0827d780ad.tar.gz chromium_src-dff69fd38aa755ecd8ddd9348fbade0827d780ad.tar.bz2 |
Improve Chrome To Mobile shapshot file handling.
Nix the ScopedTempDir previously used for snapshots.
Nix ChromeToMobileService::Init, restore logic to ctor.
Create each snapshot temp file in a blocking pool task.
Track the set of temp files to ensure deletion later.
Post sequenced tasks to submit and delete the snapshot.
Delete snapshots on bubble close or service destruction.
Use a WeakPtrFactory instead of a RefCounted* base class.
BUG=102709,121003,122135
TEST=No user-facing changes to Chrome To Mobile.
Review URL: http://codereview.chromium.org/9959132
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131664 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chrome_to_mobile_service_unittest.cc')
-rw-r--r-- | chrome/browser/chrome_to_mobile_service_unittest.cc | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/chrome/browser/chrome_to_mobile_service_unittest.cc b/chrome/browser/chrome_to_mobile_service_unittest.cc index a04937b..38c1058 100644 --- a/chrome/browser/chrome_to_mobile_service_unittest.cc +++ b/chrome/browser/chrome_to_mobile_service_unittest.cc @@ -39,12 +39,8 @@ class ChromeToMobileServiceTest : public testing::Test { ChromeToMobileServiceTest(); virtual ~ChromeToMobileServiceTest(); - virtual void SetUp() OVERRIDE { - service_ = new MockChromeToMobileService(); - } - protected: - scoped_refptr<MockChromeToMobileService> service_; + MockChromeToMobileService service_; private: DISALLOW_COPY_AND_ASSIGN(ChromeToMobileServiceTest); @@ -56,25 +52,25 @@ ChromeToMobileServiceTest::~ChromeToMobileServiceTest() {} // Ensure that RefreshAccessToken is not called for irrelevant notifications. TEST_F(ChromeToMobileServiceTest, IgnoreIrrelevantNotifications) { - EXPECT_CALL(*service_.get(), RefreshAccessToken()).Times(0); + EXPECT_CALL(service_, RefreshAccessToken()).Times(0); // Send dummy service/token details (should not refresh token). DummyNotificationSource dummy_source; TokenService::TokenAvailableDetails dummy_details(kDummyString, kDummyString); - service_->Observe(chrome::NOTIFICATION_TOKEN_AVAILABLE, + service_.Observe(chrome::NOTIFICATION_TOKEN_AVAILABLE, content::Source<DummyNotificationSource>(&dummy_source), content::Details<TokenService::TokenAvailableDetails>(&dummy_details)); } // Ensure that RefreshAccessToken is called on the proper notification. TEST_F(ChromeToMobileServiceTest, AuthenticateOnTokenAvailable) { - EXPECT_CALL(*service_.get(), RefreshAccessToken()).Times(1); + EXPECT_CALL(service_, RefreshAccessToken()).Times(1); // Send a Gaia OAuth2 Login service dummy token (should refresh token). DummyNotificationSource dummy_source; TokenService::TokenAvailableDetails login_details( GaiaConstants::kGaiaOAuth2LoginRefreshToken, kDummyString); - service_->Observe(chrome::NOTIFICATION_TOKEN_AVAILABLE, + service_.Observe(chrome::NOTIFICATION_TOKEN_AVAILABLE, content::Source<DummyNotificationSource>(&dummy_source), content::Details<TokenService::TokenAvailableDetails>(&login_details)); } |