Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Unified Diff: chrome/browser/policy/device_token_fetcher_unittest.cc

Issue 4949003: CrOS policies: Store device ID with device token (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: fix Release builds Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/policy/device_token_fetcher_unittest.cc
diff --git a/chrome/browser/policy/device_token_fetcher_unittest.cc b/chrome/browser/policy/device_token_fetcher_unittest.cc
index 8a408d60f191d638f0847a8fbf018b6ec5ab8df6..b6f50e539b648b229aeaa1fc58618bfddc94f434 100644
--- a/chrome/browser/policy/device_token_fetcher_unittest.cc
+++ b/chrome/browser/policy/device_token_fetcher_unittest.cc
@@ -85,6 +85,25 @@ TEST_F(DeviceTokenFetcherTest, IsPending) {
ASSERT_FALSE(fetcher_->IsTokenPending());
}
+TEST_F(DeviceTokenFetcherTest, StoreAndLoad) {
+ backend_->AllShouldSucceed();
+ EXPECT_CALL(*backend_, ProcessRegisterRequest(_, _, _, _)).Times(1);
+ SimulateSuccessfulLoginAndRunPending();
+ ASSERT_FALSE(fetcher_->IsTokenPending());
+ std::string device_token = fetcher_->GetDeviceToken();
+ std::string device_id = fetcher_->GetDeviceID();
+ ASSERT_NE("", device_id);
+
+ FilePath token_path;
+ GetDeviceTokenPath(fetcher_, &token_path);
+ scoped_refptr<DeviceTokenFetcher> fetcher2(
+ new DeviceTokenFetcher(backend_.get(), token_path));
+ fetcher2->StartFetching();
+ loop_.RunAllPending();
+ ASSERT_EQ(device_id, fetcher2->GetDeviceID());
+ ASSERT_EQ(device_token, fetcher2->GetDeviceToken());
+}
+
TEST_F(DeviceTokenFetcherTest, SimpleFetchSingleLogin) {
backend_->AllShouldSucceed();
EXPECT_CALL(*backend_, ProcessRegisterRequest(_, _, _, _)).Times(1);
« no previous file with comments | « chrome/browser/policy/device_token_fetcher.cc ('k') | chrome/browser/policy/proto/device_management_local.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698