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

Side by Side Diff: chrome/browser/policy/policy_browsertest.cc

Issue 11428149: Alternate NTP: Move bookmark bar to bottom (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address review comments Created 8 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 std::string expected_url("http://google.com/?"); 731 std::string expected_url("http://google.com/?");
732 expected_url += std::string(chrome::kSafeSearchSafeParameter) + "&" + 732 expected_url += std::string(chrome::kSafeSearchSafeParameter) + "&" +
733 chrome::kSafeSearchSsuiParameter; 733 chrome::kSafeSearchSsuiParameter;
734 GURL expected_with_parameters(expected_url); 734 GURL expected_with_parameters(expected_url);
735 EXPECT_EQ(expected_with_parameters, web_contents->GetURL()); 735 EXPECT_EQ(expected_with_parameters, web_contents->GetURL());
736 } 736 }
737 737
738 IN_PROC_BROWSER_TEST_F(PolicyTest, ReplaceSearchTerms) { 738 IN_PROC_BROWSER_TEST_F(PolicyTest, ReplaceSearchTerms) {
739 MakeRequestFail("search.example"); 739 MakeRequestFail("search.example");
740 740
741 CommandLine::ForCurrentProcess()->AppendSwitch( 741 chrome::search::SetForceInstantExtendedAPIEnabledForTesting(true);
742 switches::kEnableInstantExtendedAPI);
743
744 // Adding the kEnableInstantExtendedAPI is not enough since
745 // IsInstantExtendedAPIEnabled does not return true on CHANNEL_DEV.
746 if (!chrome::search::IsInstantExtendedAPIEnabled(browser()->profile()))
747 return;
748 742
749 // Verifies that a default search is made using the provider configured via 743 // Verifies that a default search is made using the provider configured via
750 // policy. Also checks that default search can be completely disabled. 744 // policy. Also checks that default search can be completely disabled.
751 const string16 kKeyword(ASCIIToUTF16("testsearch")); 745 const string16 kKeyword(ASCIIToUTF16("testsearch"));
752 const std::string kSearchURL("https://www.google.com/search?q={searchTerms}"); 746 const std::string kSearchURL("https://www.google.com/search?q={searchTerms}");
753 const std::string kAlternateURL0( 747 const std::string kAlternateURL0(
754 "https://www.google.com/search#q={searchTerms}"); 748 "https://www.google.com/search#q={searchTerms}");
755 const std::string kAlternateURL1("https://www.google.com/#q={searchTerms}"); 749 const std::string kAlternateURL1("https://www.google.com/#q={searchTerms}");
756 750
757 TemplateURLService* service = TemplateURLServiceFactory::GetForProfile( 751 TemplateURLService* service = TemplateURLServiceFactory::GetForProfile(
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 EXPECT_TRUE(model->CurrentMatch().destination_url.is_valid()); 820 EXPECT_TRUE(model->CurrentMatch().destination_url.is_valid());
827 EXPECT_EQ(ASCIIToUTF16("tractor parts"), model->CurrentMatch().contents); 821 EXPECT_EQ(ASCIIToUTF16("tractor parts"), model->CurrentMatch().contents);
828 822
829 // Verify that searching from the omnibox prioritizes hash over query. 823 // Verify that searching from the omnibox prioritizes hash over query.
830 chrome::FocusLocationBar(browser()); 824 chrome::FocusLocationBar(browser());
831 ui_test_utils::SendToOmniboxAndSubmit(location_bar, 825 ui_test_utils::SendToOmniboxAndSubmit(location_bar,
832 "https://www.google.com/search?q=tractor+parts&espv=1#q=foobar"); 826 "https://www.google.com/search?q=tractor+parts&espv=1#q=foobar");
833 model = location_bar->GetLocationEntry()->model(); 827 model = location_bar->GetLocationEntry()->model();
834 EXPECT_TRUE(model->CurrentMatch().destination_url.is_valid()); 828 EXPECT_TRUE(model->CurrentMatch().destination_url.is_valid());
835 EXPECT_EQ(ASCIIToUTF16("foobar"), model->CurrentMatch().contents); 829 EXPECT_EQ(ASCIIToUTF16("foobar"), model->CurrentMatch().contents);
830
831 chrome::search::SetForceInstantExtendedAPIEnabledForTesting(false);
836 } 832 }
837 833
838 // The linux and win bots can't create a GL context. http://crbug.com/103379 834 // The linux and win bots can't create a GL context. http://crbug.com/103379
839 #if defined(OS_MACOSX) 835 #if defined(OS_MACOSX)
840 IN_PROC_BROWSER_TEST_F(PolicyTest, Disable3DAPIs) { 836 IN_PROC_BROWSER_TEST_F(PolicyTest, Disable3DAPIs) {
841 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kAboutBlankURL)); 837 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kAboutBlankURL));
842 // WebGL is enabled by default. 838 // WebGL is enabled by default.
843 content::WebContents* contents = chrome::GetActiveWebContents(browser()); 839 content::WebContents* contents = chrome::GetActiveWebContents(browser());
844 EXPECT_TRUE(IsWebGLEnabled(contents)); 840 EXPECT_TRUE(IsWebGLEnabled(contents));
845 // Disable with a policy. 841 // Disable with a policy.
(...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after
1673 EXPECT_EQ(kExpectedLabel, text.substr(0, kExpectedLabel.size())); 1669 EXPECT_EQ(kExpectedLabel, text.substr(0, kExpectedLabel.size()));
1674 // HomepageLocation has policy ID 1. 1670 // HomepageLocation has policy ID 1.
1675 EXPECT_NE(std::string::npos, text.find("<br>1 ---")); 1671 EXPECT_NE(std::string::npos, text.find("<br>1 ---"));
1676 // ShowHomeButton has policy ID 35. 1672 // ShowHomeButton has policy ID 35.
1677 EXPECT_NE(std::string::npos, text.find("<br>35 ---")); 1673 EXPECT_NE(std::string::npos, text.find("<br>35 ---"));
1678 // BookmarkBarEnabled has policy ID 82. 1674 // BookmarkBarEnabled has policy ID 82.
1679 EXPECT_NE(std::string::npos, text.find("<br>82 ---")); 1675 EXPECT_NE(std::string::npos, text.find("<br>82 ---"));
1680 } 1676 }
1681 1677
1682 } // namespace policy 1678 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698