diff options
author | msw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-21 20:01:31 +0000 |
---|---|---|
committer | msw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-21 20:01:31 +0000 |
commit | 7911431b57acda42db3ec127aef6a5714854edab (patch) | |
tree | 83076a1e7b026a71b270c265b8b20f2c8bd3b8ad /chrome/browser/chrome_to_mobile_service_unittest.cc | |
parent | dda29c94364d6dd8896f64032dcc2561a8a217c9 (diff) | |
download | chromium_src-7911431b57acda42db3ec127aef6a5714854edab.zip chromium_src-7911431b57acda42db3ec127aef6a5714854edab.tar.gz chromium_src-7911431b57acda42db3ec127aef6a5714854edab.tar.bz2 |
Revert 152609 - Integrate invalidation API into ChromeToMobileService.
Failed? Win7 Tests (dbg)(6) browser_tests InProcessBrowserTest.Empty:
http://build.chromium.org/p/chromium/builders/Win7%20Tests%20%28dbg%29%286%29/builds/10278/steps/browser_tests/logs/stdio
Update chrome/browser/DEPS with new dependencies:
(google/cacheinvalidation and sync/notifier)
Observe Sync Notifier invalidation notifications:
(depend on this service for mobile list updates)
(refresh the device list on cloud print invalidation)
Remove RequestMobileListUpdate, timestamp, & account info:
(no longer needed with invalidation integration)
(just set command state and icon visibility w/HasMobiles)
Lazily init the access token, queue search/send operations:
(only get an access token as needed, add |task_queue_|)
Allow concurrent cloud print device search requests:
(handle user-triggered updates while fetching the list)
Misc cleanup (CloudPrintUrl handling, tests, etc.)
TODO(followup): Additional logging, tests, invalidation ack.
BUG=102709,137086
Review URL: https://chromiumcodereview.appspot.com/10834203
TBR=msw@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10861038
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152613 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 | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/chrome/browser/chrome_to_mobile_service_unittest.cc b/chrome/browser/chrome_to_mobile_service_unittest.cc index 8cff191..d1e6d41 100644 --- a/chrome/browser/chrome_to_mobile_service_unittest.cc +++ b/chrome/browser/chrome_to_mobile_service_unittest.cc @@ -17,6 +17,7 @@ const char kDummyString[] = "dummy"; class DummyNotificationSource {}; +// A mock ChromeToMobileService with a mocked out RequestAccessToken method. class MockChromeToMobileService : public ChromeToMobileService { public: MockChromeToMobileService(); @@ -49,37 +50,29 @@ ChromeToMobileServiceTest::ChromeToMobileServiceTest() {} ChromeToMobileServiceTest::~ChromeToMobileServiceTest() {} -// Ensure that irrelevant notifications do not invalidate the access token. +// Ensure that RequestAccessToken is not called for irrelevant notifications. TEST_F(ChromeToMobileServiceTest, IgnoreIrrelevantNotifications) { EXPECT_CALL(service_, RequestAccessToken()).Times(0); - service_.SetAccessTokenForTest(kDummyString); - ASSERT_FALSE(service_.GetAccessTokenForTest().empty()); - - // Send dummy service/token details (should not request token). + // Send dummy service/token details (should not refresh token). DummyNotificationSource dummy_source; TokenService::TokenAvailableDetails dummy_details(kDummyString, kDummyString); service_.Observe(chrome::NOTIFICATION_TOKEN_AVAILABLE, content::Source<DummyNotificationSource>(&dummy_source), content::Details<TokenService::TokenAvailableDetails>(&dummy_details)); - EXPECT_FALSE(service_.GetAccessTokenForTest().empty()); } -// Ensure that proper notifications invalidate the access token. +// Ensure that RequestAccessToken is called on the proper notification. TEST_F(ChromeToMobileServiceTest, AuthenticateOnTokenAvailable) { - EXPECT_CALL(service_, RequestAccessToken()).Times(0); - - service_.SetAccessTokenForTest(kDummyString); - ASSERT_FALSE(service_.GetAccessTokenForTest().empty()); + EXPECT_CALL(service_, RequestAccessToken()).Times(1); - // Send a Gaia OAuth2 Login service dummy token (should request token). + // 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, content::Source<DummyNotificationSource>(&dummy_source), content::Details<TokenService::TokenAvailableDetails>(&login_details)); - EXPECT_TRUE(service_.GetAccessTokenForTest().empty()); } } // namespace |