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

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

Issue 5178005: Rework the device management backend implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
« no previous file with comments | « chrome/browser/policy/device_token_fetcher.cc ('k') | chrome/browser/prefs/pref_notifier_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ea1e41d971d08af1601ac4db01396914bd098919..754628615a0a01aa7e63e646caadd32d8b2f1862 100644
--- a/chrome/browser/policy/device_token_fetcher_unittest.cc
+++ b/chrome/browser/policy/device_token_fetcher_unittest.cc
@@ -11,13 +11,15 @@
#include "chrome/browser/net/gaia/token_service.h"
#include "chrome/browser/policy/device_token_fetcher.h"
#include "chrome/browser/policy/mock_device_management_backend.h"
+#include "chrome/common/net/gaia/gaia_constants.h"
#include "chrome/common/notification_service.h"
-#include "chrome/test/device_management_test_util.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace policy {
+const char kTestToken[] = "device_token_fetcher_test_auth_token";
+
using testing::_;
using testing::Mock;
@@ -46,19 +48,24 @@ class DeviceTokenFetcherTest : public testing::Test {
}
virtual void TearDown() {
+ backend_.reset();
+ token_service_.reset();
loop_.RunAllPending();
}
void SimulateSuccessfulLoginAndRunPending() {
loop_.RunAllPending();
- SimulateSuccessfulLogin();
+ token_service_->IssueAuthTokenForTest(
+ GaiaConstants::kDeviceManagementService, kTestToken);
loop_.RunAllPending();
}
DeviceTokenFetcher* NewTestFetcher(const FilePath& token_dir) {
+ token_service_.reset(new TokenService);
backend_.reset(new MockDeviceManagementBackend());
return new DeviceTokenFetcher(
backend_.get(),
+ token_service_.get(),
token_dir.Append(FILE_PATH_LITERAL("test-token-file.txt")));
}
@@ -72,6 +79,7 @@ class DeviceTokenFetcherTest : public testing::Test {
}
MessageLoop loop_;
+ scoped_ptr<TokenService> token_service_;
scoped_ptr<MockDeviceManagementBackend> backend_;
ScopedTempDir temp_user_data_dir_;
scoped_refptr<DeviceTokenFetcher> fetcher_;
@@ -101,7 +109,7 @@ TEST_F(DeviceTokenFetcherTest, StoreAndLoad) {
FilePath token_path;
GetDeviceTokenPath(fetcher_, &token_path);
scoped_refptr<DeviceTokenFetcher> fetcher2(
- new DeviceTokenFetcher(backend_.get(), token_path));
+ new DeviceTokenFetcher(backend_.get(), token_service_.get(), token_path));
fetcher2->StartFetching();
loop_.RunAllPending();
ASSERT_EQ(device_id, fetcher2->GetDeviceID());
« no previous file with comments | « chrome/browser/policy/device_token_fetcher.cc ('k') | chrome/browser/prefs/pref_notifier_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698