| Index: chrome/browser/search/search_unittest.cc
|
| diff --git a/chrome/browser/search/search_unittest.cc b/chrome/browser/search/search_unittest.cc
|
| index 6d76b0a8dce01d14a886f802485d0485e35ce806..083bb6cc85083294053c4f5a81a4ddbe925247dc 100644
|
| --- a/chrome/browser/search/search_unittest.cc
|
| +++ b/chrome/browser/search/search_unittest.cc
|
| @@ -218,6 +218,11 @@ class SearchTest : public BrowserWithTestWindowTest {
|
| contents->GetRenderProcessHost()->GetID());
|
| }
|
|
|
| + content::BrowserContext* AsBrowserContext(Profile* profile) {
|
| + // Following implementation of FromBrowserContext:
|
| + return static_cast<Profile*>(profile);
|
| + }
|
| +
|
| scoped_ptr<base::FieldTrialList> field_trial_list_;
|
| };
|
|
|
| @@ -521,9 +526,13 @@ TEST_F(SearchTest, InstantCacheableNTPNavigationEntryNewProfile) {
|
| controller.GetLastCommittedEntry()));
|
| }
|
|
|
| -TEST_F(SearchTest, UseLocalNTPInIncognito) {
|
| - EXPECT_EQ(GURL(), chrome::GetNewTabPageURL(
|
| - profile()->GetOffTheRecordProfile()));
|
| +TEST_F(SearchTest, NoRewriteInIncognito) {
|
| + profile()->ForceIncognito(true);
|
| + EXPECT_EQ(GURL(), chrome::GetNewTabPageURL(profile()));
|
| + GURL new_tab_url(chrome::kChromeUINewTabURL);
|
| + EXPECT_FALSE(HandleNewTabURLRewrite(&new_tab_url, AsBrowserContext(
|
| + profile())));
|
| + EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), new_tab_url);
|
| }
|
|
|
| TEST_F(SearchTest, UseLocalNTPIfNTPURLIsInsecure) {
|
| @@ -531,6 +540,10 @@ TEST_F(SearchTest, UseLocalNTPIfNTPURLIsInsecure) {
|
| SetSearchProvider(true, true);
|
| EXPECT_EQ(GURL(chrome::kChromeSearchLocalNtpUrl),
|
| chrome::GetNewTabPageURL(profile()));
|
| + GURL new_tab_url(chrome::kChromeUINewTabURL);
|
| + EXPECT_TRUE(
|
| + HandleNewTabURLRewrite(&new_tab_url, AsBrowserContext(profile())));
|
| + EXPECT_EQ(GURL(chrome::kChromeSearchLocalNtpUrl), new_tab_url);
|
| }
|
|
|
| TEST_F(SearchTest, UseLocalNTPIfNTPURLIsNotSet) {
|
| @@ -538,6 +551,10 @@ TEST_F(SearchTest, UseLocalNTPIfNTPURLIsNotSet) {
|
| SetSearchProvider(false, true);
|
| EXPECT_EQ(GURL(chrome::kChromeSearchLocalNtpUrl),
|
| chrome::GetNewTabPageURL(profile()));
|
| + GURL new_tab_url(chrome::kChromeUINewTabURL);
|
| + EXPECT_TRUE(
|
| + HandleNewTabURLRewrite(&new_tab_url, AsBrowserContext(profile())));
|
| + EXPECT_EQ(GURL(chrome::kChromeSearchLocalNtpUrl), new_tab_url);
|
| }
|
|
|
| TEST_F(SearchTest, UseLocalNTPIfNTPURLIsBlockedForSupervisedUser) {
|
| @@ -552,6 +569,10 @@ TEST_F(SearchTest, UseLocalNTPIfNTPURLIsBlockedForSupervisedUser) {
|
|
|
| EXPECT_EQ(GURL(chrome::kChromeSearchLocalNtpUrl),
|
| chrome::GetNewTabPageURL(profile()));
|
| + GURL new_tab_url(chrome::kChromeUINewTabURL);
|
| + EXPECT_TRUE(
|
| + HandleNewTabURLRewrite(&new_tab_url, AsBrowserContext(profile())));
|
| + EXPECT_EQ(GURL(chrome::kChromeSearchLocalNtpUrl), new_tab_url);
|
| EXPECT_EQ(GURL(), GetInstantURL(profile(), kDisableStartMargin, false));
|
| }
|
|
|
|
|