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

Unified Diff: chrome/browser/search/hotword_service_unittest.cc

Issue 556173002: Ensure incognito TestingProfiles are incognito for their whole lifetime. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: respond to comments Created 6 years, 3 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/search/hotword_service_unittest.cc
diff --git a/chrome/browser/search/hotword_service_unittest.cc b/chrome/browser/search/hotword_service_unittest.cc
index f6912a52d8ff1ef826fd6b5826b5ce88589b7b32..b878ee940eca1d27c9e69b3c537765537d2374d0 100644
--- a/chrome/browser/search/hotword_service_unittest.cc
+++ b/chrome/browser/search/hotword_service_unittest.cc
@@ -92,10 +92,7 @@ class HotwordServiceTest : public extensions::ExtensionServiceTestBase {
TEST_F(HotwordServiceTest, IsHotwordAllowedBadFieldTrial) {
TestingProfile::Builder profile_builder;
- TestingProfile::Builder otr_profile_builder;
- otr_profile_builder.SetIncognito();
scoped_ptr<TestingProfile> profile = profile_builder.Build();
- scoped_ptr<TestingProfile> otr_profile = otr_profile_builder.Build();
HotwordServiceFactory* hotword_service_factory =
HotwordServiceFactory::GetInstance();
@@ -126,15 +123,13 @@ TEST_F(HotwordServiceTest, IsHotwordAllowedBadFieldTrial) {
EXPECT_FALSE(HotwordServiceFactory::IsHotwordAllowed(profile.get()));
// Test that incognito returns false as well.
- EXPECT_FALSE(HotwordServiceFactory::IsHotwordAllowed(otr_profile.get()));
+ EXPECT_FALSE(HotwordServiceFactory::IsHotwordAllowed(
+ profile->GetOffTheRecordProfile()));
}
TEST_F(HotwordServiceTest, IsHotwordAllowedLocale) {
TestingProfile::Builder profile_builder;
- TestingProfile::Builder otr_profile_builder;
- otr_profile_builder.SetIncognito();
scoped_ptr<TestingProfile> profile = profile_builder.Build();
- scoped_ptr<TestingProfile> otr_profile = otr_profile_builder.Build();
HotwordServiceFactory* hotword_service_factory =
HotwordServiceFactory::GetInstance();
@@ -167,8 +162,9 @@ TEST_F(HotwordServiceTest, IsHotwordAllowedLocale) {
// Test that incognito even with a valid locale and valid field trial
// still returns false.
- SetApplicationLocale(static_cast<Profile*>(otr_profile.get()), "en");
- EXPECT_FALSE(HotwordServiceFactory::IsHotwordAllowed(otr_profile.get()));
+ Profile* otr_profile = profile->GetOffTheRecordProfile();
+ SetApplicationLocale(otr_profile, "en");
+ EXPECT_FALSE(HotwordServiceFactory::IsHotwordAllowed(otr_profile));
}
TEST_F(HotwordServiceTest, AudioLoggingPrefSetCorrectly) {

Powered by Google App Engine
This is Rietveld 408576698