| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 984 std::string expected_url("http://google.com/?"); | 984 std::string expected_url("http://google.com/?"); |
| 985 expected_url += std::string(chrome::kSafeSearchSafeParameter) + "&" + | 985 expected_url += std::string(chrome::kSafeSearchSafeParameter) + "&" + |
| 986 chrome::kSafeSearchSsuiParameter; | 986 chrome::kSafeSearchSsuiParameter; |
| 987 GURL expected_with_parameters(expected_url); | 987 GURL expected_with_parameters(expected_url); |
| 988 EXPECT_EQ(expected_with_parameters, web_contents->GetURL()); | 988 EXPECT_EQ(expected_with_parameters, web_contents->GetURL()); |
| 989 } | 989 } |
| 990 | 990 |
| 991 IN_PROC_BROWSER_TEST_F(PolicyTest, ReplaceSearchTerms) { | 991 IN_PROC_BROWSER_TEST_F(PolicyTest, ReplaceSearchTerms) { |
| 992 MakeRequestFail make_request_fail("search.example"); | 992 MakeRequestFail make_request_fail("search.example"); |
| 993 | 993 |
| 994 chrome::EnableInstantExtendedAPIForTesting(); | 994 chrome::EnableQueryExtractionForTesting(); |
| 995 | 995 |
| 996 // Verifies that a default search is made using the provider configured via | 996 // Verifies that a default search is made using the provider configured via |
| 997 // policy. Also checks that default search can be completely disabled. | 997 // policy. Also checks that default search can be completely disabled. |
| 998 const string16 kKeyword(ASCIIToUTF16("testsearch")); | 998 const string16 kKeyword(ASCIIToUTF16("testsearch")); |
| 999 const std::string kSearchURL("https://www.google.com/search?q={searchTerms}"); | 999 const std::string kSearchURL("https://www.google.com/search?q={searchTerms}"); |
| 1000 const std::string kInstantURL("http://does/not/exist"); | 1000 const std::string kInstantURL("http://does/not/exist"); |
| 1001 const std::string kAlternateURL0( | 1001 const std::string kAlternateURL0( |
| 1002 "https://www.google.com/search#q={searchTerms}"); | 1002 "https://www.google.com/search#q={searchTerms}"); |
| 1003 const std::string kAlternateURL1("https://www.google.com/#q={searchTerms}"); | 1003 const std::string kAlternateURL1("https://www.google.com/#q={searchTerms}"); |
| 1004 const std::string kSearchTermsReplacementKey( | 1004 const std::string kSearchTermsReplacementKey( |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1324 UpdateProviderPolicy(policies); | 1324 UpdateProviderPolicy(policies); |
| 1325 // wait for devtools close | 1325 // wait for devtools close |
| 1326 close_observer.Wait(); | 1326 close_observer.Wait(); |
| 1327 // The existing devtools window should have closed. | 1327 // The existing devtools window should have closed. |
| 1328 EXPECT_FALSE(DevToolsWindow::GetDockedInstanceForInspectedTab(contents)); | 1328 EXPECT_FALSE(DevToolsWindow::GetDockedInstanceForInspectedTab(contents)); |
| 1329 // And it's not possible to open it again. | 1329 // And it's not possible to open it again. |
| 1330 EXPECT_FALSE(chrome::ExecuteCommand(browser(), IDC_DEV_TOOLS)); | 1330 EXPECT_FALSE(chrome::ExecuteCommand(browser(), IDC_DEV_TOOLS)); |
| 1331 EXPECT_FALSE(DevToolsWindow::GetDockedInstanceForInspectedTab(contents)); | 1331 EXPECT_FALSE(DevToolsWindow::GetDockedInstanceForInspectedTab(contents)); |
| 1332 } | 1332 } |
| 1333 | 1333 |
| 1334 IN_PROC_BROWSER_TEST_F(PolicyTest, WebStoreIconHidden) { | 1334 // TODO(samarth): remove along with rest of NTP4 code. |
| 1335 IN_PROC_BROWSER_TEST_F(PolicyTest, DISABLED_WebStoreIconHidden) { |
| 1335 #if defined(OS_WIN) && defined(USE_ASH) | 1336 #if defined(OS_WIN) && defined(USE_ASH) |
| 1336 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 1337 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
| 1337 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 1338 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) |
| 1338 return; | 1339 return; |
| 1339 #endif | 1340 #endif |
| 1340 | 1341 |
| 1341 // Verifies that the web store icons can be hidden from the new tab page. | 1342 // Verifies that the web store icons can be hidden from the new tab page. |
| 1342 | 1343 |
| 1343 // Open new tab page and look for the web store icons. | 1344 // Open new tab page and look for the web store icons. |
| 1344 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL)); | 1345 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL)); |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1707 UpdateProviderPolicy(policies); | 1708 UpdateProviderPolicy(policies); |
| 1708 EXPECT_TRUE(chrome::ExecuteCommand(browser(), IDC_HOME)); | 1709 EXPECT_TRUE(chrome::ExecuteCommand(browser(), IDC_HOME)); |
| 1709 content::WaitForLoadStop(contents); | 1710 content::WaitForLoadStop(contents); |
| 1710 EXPECT_EQ(GURL(chrome::kChromeUICreditsURL), contents->GetURL()); | 1711 EXPECT_EQ(GURL(chrome::kChromeUICreditsURL), contents->GetURL()); |
| 1711 | 1712 |
| 1712 policies.Set(key::kHomepageIsNewTabPage, POLICY_LEVEL_MANDATORY, | 1713 policies.Set(key::kHomepageIsNewTabPage, POLICY_LEVEL_MANDATORY, |
| 1713 POLICY_SCOPE_USER, base::Value::CreateBooleanValue(true), NULL); | 1714 POLICY_SCOPE_USER, base::Value::CreateBooleanValue(true), NULL); |
| 1714 UpdateProviderPolicy(policies); | 1715 UpdateProviderPolicy(policies); |
| 1715 EXPECT_TRUE(chrome::ExecuteCommand(browser(), IDC_HOME)); | 1716 EXPECT_TRUE(chrome::ExecuteCommand(browser(), IDC_HOME)); |
| 1716 content::WaitForLoadStop(contents); | 1717 content::WaitForLoadStop(contents); |
| 1717 EXPECT_TRUE(chrome::IsNTPURL(contents->GetURL(),browser()->profile())); | 1718 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), contents->GetURL()); |
| 1718 } | 1719 } |
| 1719 | 1720 |
| 1720 IN_PROC_BROWSER_TEST_F(PolicyTest, IncognitoEnabled) { | 1721 IN_PROC_BROWSER_TEST_F(PolicyTest, IncognitoEnabled) { |
| 1721 // Verifies that incognito windows can't be opened when disabled by policy. | 1722 // Verifies that incognito windows can't be opened when disabled by policy. |
| 1722 | 1723 |
| 1723 const BrowserList* active_browser_list = | 1724 const BrowserList* active_browser_list = |
| 1724 BrowserList::GetInstance(chrome::GetActiveDesktop()); | 1725 BrowserList::GetInstance(chrome::GetActiveDesktop()); |
| 1725 | 1726 |
| 1726 // Disable incognito via policy and verify that incognito windows can't be | 1727 // Disable incognito via policy and verify that incognito windows can't be |
| 1727 // opened. | 1728 // opened. |
| (...skipping 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2834 chrome_variations::VariationsService::GetVariationsServerURL( | 2835 chrome_variations::VariationsService::GetVariationsServerURL( |
| 2835 g_browser_process->local_state()); | 2836 g_browser_process->local_state()); |
| 2836 EXPECT_TRUE(StartsWithASCII(url.spec(), default_variations_url, true)); | 2837 EXPECT_TRUE(StartsWithASCII(url.spec(), default_variations_url, true)); |
| 2837 std::string value; | 2838 std::string value; |
| 2838 EXPECT_TRUE(net::GetValueForKeyInQuery(url, "restrict", &value)); | 2839 EXPECT_TRUE(net::GetValueForKeyInQuery(url, "restrict", &value)); |
| 2839 EXPECT_EQ("restricted", value); | 2840 EXPECT_EQ("restricted", value); |
| 2840 } | 2841 } |
| 2841 #endif | 2842 #endif |
| 2842 | 2843 |
| 2843 } // namespace policy | 2844 } // namespace policy |
| OLD | NEW |