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

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

Issue 461633002: Refactor language detection logic to allow non-static CLD data sources. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Create a factory for test harnesses and use it Created 6 years, 2 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 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 #include "chrome/browser/policy/profile_policy_connector.h" 51 #include "chrome/browser/policy/profile_policy_connector.h"
52 #include "chrome/browser/policy/profile_policy_connector_factory.h" 52 #include "chrome/browser/policy/profile_policy_connector_factory.h"
53 #include "chrome/browser/prefs/session_startup_pref.h" 53 #include "chrome/browser/prefs/session_startup_pref.h"
54 #include "chrome/browser/profiles/profile.h" 54 #include "chrome/browser/profiles/profile.h"
55 #include "chrome/browser/search/instant_service.h" 55 #include "chrome/browser/search/instant_service.h"
56 #include "chrome/browser/search/instant_service_factory.h" 56 #include "chrome/browser/search/instant_service_factory.h"
57 #include "chrome/browser/search/search.h" 57 #include "chrome/browser/search/search.h"
58 #include "chrome/browser/search_engines/template_url_service_factory.h" 58 #include "chrome/browser/search_engines/template_url_service_factory.h"
59 #include "chrome/browser/translate/chrome_translate_client.h" 59 #include "chrome/browser/translate/chrome_translate_client.h"
60 #include "chrome/browser/translate/cld_data_harness.h" 60 #include "chrome/browser/translate/cld_data_harness.h"
61 #include "chrome/browser/translate/cld_data_harness_factory.h"
61 #include "chrome/browser/translate/translate_service.h" 62 #include "chrome/browser/translate/translate_service.h"
62 #include "chrome/browser/ui/bookmarks/bookmark_bar.h" 63 #include "chrome/browser/ui/bookmarks/bookmark_bar.h"
63 #include "chrome/browser/ui/browser.h" 64 #include "chrome/browser/ui/browser.h"
64 #include "chrome/browser/ui/browser_commands.h" 65 #include "chrome/browser/ui/browser_commands.h"
65 #include "chrome/browser/ui/browser_list.h" 66 #include "chrome/browser/ui/browser_list.h"
66 #include "chrome/browser/ui/browser_tabstrip.h" 67 #include "chrome/browser/ui/browser_tabstrip.h"
67 #include "chrome/browser/ui/browser_window.h" 68 #include "chrome/browser/ui/browser_window.h"
68 #include "chrome/browser/ui/host_desktop.h" 69 #include "chrome/browser/ui/host_desktop.h"
69 #include "chrome/browser/ui/location_bar/location_bar.h" 70 #include "chrome/browser/ui/location_bar/location_bar.h"
70 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h" 71 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h"
(...skipping 1924 matching lines...) Expand 10 before | Expand all | Expand 10 after
1995 EXPECT_EQ(url, enumerator2.urls()[0]); 1996 EXPECT_EQ(url, enumerator2.urls()[0]);
1996 } 1997 }
1997 1998
1998 // http://crbug.com/241691 PolicyTest.TranslateEnabled is failing regularly. 1999 // http://crbug.com/241691 PolicyTest.TranslateEnabled is failing regularly.
1999 IN_PROC_BROWSER_TEST_F(PolicyTest, DISABLED_TranslateEnabled) { 2000 IN_PROC_BROWSER_TEST_F(PolicyTest, DISABLED_TranslateEnabled) {
2000 // TODO(port): Test corresponding bubble translate UX: http://crbug.com/383235 2001 // TODO(port): Test corresponding bubble translate UX: http://crbug.com/383235
2001 if (TranslateService::IsTranslateBubbleEnabled()) 2002 if (TranslateService::IsTranslateBubbleEnabled())
2002 return; 2003 return;
2003 2004
2004 scoped_ptr<test::CldDataHarness> cld_data_scope = 2005 scoped_ptr<test::CldDataHarness> cld_data_scope =
2005 test::CreateCldDataHarness(); 2006 test::CldDataHarnessFactory::Get()->CreateCldDataHarness();
2006 ASSERT_NO_FATAL_FAILURE(cld_data_scope->Init()); 2007 ASSERT_NO_FATAL_FAILURE(cld_data_scope->Init());
2007 2008
2008 // Verifies that translate can be forced enabled or disabled by policy. 2009 // Verifies that translate can be forced enabled or disabled by policy.
2009 2010
2010 // Get the InfoBarService, and verify that there are no infobars on startup. 2011 // Get the InfoBarService, and verify that there are no infobars on startup.
2011 content::WebContents* contents = 2012 content::WebContents* contents =
2012 browser()->tab_strip_model()->GetActiveWebContents(); 2013 browser()->tab_strip_model()->GetActiveWebContents();
2013 ASSERT_TRUE(contents); 2014 ASSERT_TRUE(contents);
2014 InfoBarService* infobar_service = InfoBarService::FromWebContents(contents); 2015 InfoBarService* infobar_service = InfoBarService::FromWebContents(contents);
2015 ASSERT_TRUE(infobar_service); 2016 ASSERT_TRUE(infobar_service);
(...skipping 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after
3227 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( 3228 EXPECT_TRUE(content::ExecuteScriptAndExtractBool(
3228 browser2->tab_strip_model()->GetActiveWebContents(), 3229 browser2->tab_strip_model()->GetActiveWebContents(),
3229 "domAutomationController.send(window.showModalDialog !== undefined);", 3230 "domAutomationController.send(window.showModalDialog !== undefined);",
3230 &result)); 3231 &result));
3231 EXPECT_TRUE(result); 3232 EXPECT_TRUE(result);
3232 } 3233 }
3233 3234
3234 #endif // !defined(CHROME_OS) 3235 #endif // !defined(CHROME_OS)
3235 3236
3236 } // namespace policy 3237 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698