| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 GURL new_tab_url(chrome::kChromeUINewTabURL); | 431 GURL new_tab_url(chrome::kChromeUINewTabURL); |
| 432 EXPECT_TRUE(HandleNewTabURLRewrite(&new_tab_url, profile())); | 432 EXPECT_TRUE(HandleNewTabURLRewrite(&new_tab_url, profile())); |
| 433 EXPECT_EQ(GURL(chrome::kChromeSearchLocalNtpUrl), new_tab_url); | 433 EXPECT_EQ(GURL(chrome::kChromeSearchLocalNtpUrl), new_tab_url); |
| 434 } | 434 } |
| 435 | 435 |
| 436 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) | 436 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) |
| 437 TEST_F(SearchTest, UseLocalNTPIfNTPURLIsBlockedForSupervisedUser) { | 437 TEST_F(SearchTest, UseLocalNTPIfNTPURLIsBlockedForSupervisedUser) { |
| 438 // Block access to foo.com in the URL filter. | 438 // Block access to foo.com in the URL filter. |
| 439 SupervisedUserService* supervised_user_service = | 439 SupervisedUserService* supervised_user_service = |
| 440 SupervisedUserServiceFactory::GetForProfile(profile()); | 440 SupervisedUserServiceFactory::GetForProfile(profile()); |
| 441 SupervisedUserURLFilter* url_filter = | 441 SupervisedUserURLFilter* url_filter = supervised_user_service->GetURLFilter(); |
| 442 supervised_user_service->GetURLFilterForUIThread(); | |
| 443 std::map<std::string, bool> hosts; | 442 std::map<std::string, bool> hosts; |
| 444 hosts["foo.com"] = false; | 443 hosts["foo.com"] = false; |
| 445 url_filter->SetManualHosts(&hosts); | 444 url_filter->SetManualHosts(std::move(hosts)); |
| 446 | 445 |
| 447 EXPECT_EQ(GURL(chrome::kChromeSearchLocalNtpUrl), | 446 EXPECT_EQ(GURL(chrome::kChromeSearchLocalNtpUrl), |
| 448 GetNewTabPageURL(profile())); | 447 GetNewTabPageURL(profile())); |
| 449 GURL new_tab_url(chrome::kChromeUINewTabURL); | 448 GURL new_tab_url(chrome::kChromeUINewTabURL); |
| 450 EXPECT_TRUE(HandleNewTabURLRewrite(&new_tab_url, profile())); | 449 EXPECT_TRUE(HandleNewTabURLRewrite(&new_tab_url, profile())); |
| 451 EXPECT_EQ(GURL(chrome::kChromeSearchLocalNtpUrl), new_tab_url); | 450 EXPECT_EQ(GURL(chrome::kChromeSearchLocalNtpUrl), new_tab_url); |
| 452 EXPECT_EQ(GURL(), GetInstantURL(profile(), false)); | 451 EXPECT_EQ(GURL(), GetInstantURL(profile(), false)); |
| 453 } | 452 } |
| 454 #endif | 453 #endif |
| 455 | 454 |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 TemplateURLRef::SearchTermsArgs search_terms_args(base::ASCIIToUTF16("foo")); | 641 TemplateURLRef::SearchTermsArgs search_terms_args(base::ASCIIToUTF16("foo")); |
| 643 GURL result(template_url_->url_ref().ReplaceSearchTerms( | 642 GURL result(template_url_->url_ref().ReplaceSearchTerms( |
| 644 search_terms_args, UIThreadSearchTermsData(profile()))); | 643 search_terms_args, UIThreadSearchTermsData(profile()))); |
| 645 ASSERT_TRUE(result.is_valid()); | 644 ASSERT_TRUE(result.is_valid()); |
| 646 // Query extraction is disabled. Make sure | 645 // Query extraction is disabled. Make sure |
| 647 // {google:instantExtendedEnabledParameter} is not set in the search URL. | 646 // {google:instantExtendedEnabledParameter} is not set in the search URL. |
| 648 EXPECT_EQ("http://www.google.com/search?q=foo", result.spec()); | 647 EXPECT_EQ("http://www.google.com/search?q=foo", result.spec()); |
| 649 } | 648 } |
| 650 | 649 |
| 651 } // namespace search | 650 } // namespace search |
| OLD | NEW |