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

Unified Diff: chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos_unittest.cc

Issue 17127002: Correctly integrate StoragePartition into TestingProfile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix InstantNTP test. Created 7 years, 5 months 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/chromeos/policy/user_cloud_policy_manager_chromeos_unittest.cc
diff --git a/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos_unittest.cc b/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos_unittest.cc
index 53c3c82e4b9de49787a610dffdc83639b2d93081..7c3d9df549301e5be8690b458389293b654a4fe8 100644
--- a/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos_unittest.cc
+++ b/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos_unittest.cc
@@ -33,7 +33,7 @@
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile.h"
#include "chrome/test/base/testing_profile_manager.h"
-#include "content/public/test/test_browser_thread.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "google_apis/gaia/gaia_auth_consumer.h"
#include "google_apis/gaia/gaia_urls.h"
#include "net/url_request/test_url_fetcher_factory.h"
@@ -75,9 +75,7 @@ const char kOAuth2AccessTokenData[] =
class UserCloudPolicyManagerChromeOSTest : public testing::Test {
protected:
UserCloudPolicyManagerChromeOSTest()
- : ui_thread_(content::BrowserThread::UI, &loop_),
- io_thread_(content::BrowserThread::IO, &loop_),
- store_(NULL),
+ : store_(NULL),
profile_(NULL),
signin_profile_(NULL) {}
@@ -90,14 +88,13 @@ class UserCloudPolicyManagerChromeOSTest : public testing::Test {
profile_ = profile_manager_->CreateTestingProfile(
chrome::kInitialProfile, scoped_ptr<PrefServiceSyncable>(),
UTF8ToUTF16("testing_profile"), 0);
- signin_profile_ = profile_manager_->CreateTestingProfile("signin_profile");
+ signin_profile_ = profile_manager_->CreateTestingProfile(kSigninProfile);
signin_profile_->set_incognito(true);
// Usually the signin Profile and the main Profile are separate, but since
// the signin Profile is an OTR Profile then for this test it suffices to
// attach it to the main Profile.
profile_->SetOffTheRecordProfile(signin_profile_);
signin_profile_->SetOriginalProfile(profile_);
- signin_profile_->CreateRequestContext();
ASSERT_EQ(signin_profile_, chromeos::ProfileHelper::GetSigninProfile());
chrome::RegisterLocalState(prefs_.registry());
@@ -136,7 +133,10 @@ class UserCloudPolicyManagerChromeOSTest : public testing::Test {
manager_->RemoveObserver(&observer_);
manager_->Shutdown();
}
- signin_profile_->ResetRequestContext();
+ signin_profile_ = NULL;
+ profile_ = NULL;
+ profile_manager_->DeleteTestingProfile(kSigninProfile);
+ profile_manager_->DeleteTestingProfile(chrome::kInitialProfile);
}
void CreateManager(bool wait_for_fetch) {
@@ -265,11 +265,9 @@ class UserCloudPolicyManagerChromeOSTest : public testing::Test {
EXPECT_TRUE(manager_->policies().Equals(expected_bundle_));
}
- // Required by the refresh scheduler that's created by the manager.
- base::MessageLoop loop_;
- content::TestBrowserThread ui_thread_;
- // Required to cleanup the URLRequestContextGetter of the |signin_profile_|.
- content::TestBrowserThread io_thread_;
+ // Required by the refresh scheduler that's created by the manager and
+ // for the cleanup of URLRequestContextGetter in the |signin_profile_|.
+ content::TestBrowserThreadBundle thread_bundle_;
// Convenience policy objects.
em::PolicyData policy_data_;
@@ -292,10 +290,15 @@ class UserCloudPolicyManagerChromeOSTest : public testing::Test {
TestingProfile* profile_;
TestingProfile* signin_profile_;
+ static const char kSigninProfile[];
+
private:
DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerChromeOSTest);
};
+const char UserCloudPolicyManagerChromeOSTest::kSigninProfile[] =
+ "signin_profile";
+
TEST_F(UserCloudPolicyManagerChromeOSTest, BlockingFirstFetch) {
// Tests the initialization of a manager whose Profile is waiting for the
// initial fetch, when the policy cache is empty.

Powered by Google App Engine
This is Rietveld 408576698