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

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

Issue 1313213005: Turn VariationsService::GetVariationsServerURL into instance method (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Response to review Created 5 years, 3 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
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 30 matching lines...) Expand all
41 #include "chrome/browser/extensions/extension_service.h" 41 #include "chrome/browser/extensions/extension_service.h"
42 #include "chrome/browser/extensions/shared_module_service.h" 42 #include "chrome/browser/extensions/shared_module_service.h"
43 #include "chrome/browser/extensions/unpacked_installer.h" 43 #include "chrome/browser/extensions/unpacked_installer.h"
44 #include "chrome/browser/extensions/updater/extension_cache_fake.h" 44 #include "chrome/browser/extensions/updater/extension_cache_fake.h"
45 #include "chrome/browser/extensions/updater/extension_updater.h" 45 #include "chrome/browser/extensions/updater/extension_updater.h"
46 #include "chrome/browser/infobars/infobar_service.h" 46 #include "chrome/browser/infobars/infobar_service.h"
47 #include "chrome/browser/interstitials/security_interstitial_page.h" 47 #include "chrome/browser/interstitials/security_interstitial_page.h"
48 #include "chrome/browser/interstitials/security_interstitial_page_test_utils.h" 48 #include "chrome/browser/interstitials/security_interstitial_page_test_utils.h"
49 #include "chrome/browser/media/media_capture_devices_dispatcher.h" 49 #include "chrome/browser/media/media_capture_devices_dispatcher.h"
50 #include "chrome/browser/media/media_stream_devices_controller.h" 50 #include "chrome/browser/media/media_stream_devices_controller.h"
51 #include "chrome/browser/metrics/variations/chrome_variations_service_client.h"
51 #include "chrome/browser/metrics/variations/variations_service.h" 52 #include "chrome/browser/metrics/variations/variations_service.h"
52 #include "chrome/browser/net/prediction_options.h" 53 #include "chrome/browser/net/prediction_options.h"
53 #include "chrome/browser/net/url_request_mock_util.h" 54 #include "chrome/browser/net/url_request_mock_util.h"
54 #include "chrome/browser/plugins/plugin_prefs.h" 55 #include "chrome/browser/plugins/plugin_prefs.h"
55 #include "chrome/browser/policy/cloud/test_request_interceptor.h" 56 #include "chrome/browser/policy/cloud/test_request_interceptor.h"
56 #include "chrome/browser/policy/profile_policy_connector.h" 57 #include "chrome/browser/policy/profile_policy_connector.h"
57 #include "chrome/browser/policy/profile_policy_connector_factory.h" 58 #include "chrome/browser/policy/profile_policy_connector_factory.h"
58 #include "chrome/browser/prefs/session_startup_pref.h" 59 #include "chrome/browser/prefs/session_startup_pref.h"
59 #include "chrome/browser/profiles/profile.h" 60 #include "chrome/browser/profiles/profile.h"
60 #include "chrome/browser/search/instant_service.h" 61 #include "chrome/browser/search/instant_service.h"
(...skipping 3706 matching lines...) Expand 10 before | Expand all | Expand 10 after
3767 NULL); 3768 NULL);
3768 provider_.UpdateChromePolicy(policies); 3769 provider_.UpdateChromePolicy(policies);
3769 } 3770 }
3770 }; 3771 };
3771 3772
3772 IN_PROC_BROWSER_TEST_F(PolicyVariationsServiceTest, VariationsURLIsValid) { 3773 IN_PROC_BROWSER_TEST_F(PolicyVariationsServiceTest, VariationsURLIsValid) {
3773 const std::string default_variations_url = 3774 const std::string default_variations_url =
3774 chrome_variations::VariationsService:: 3775 chrome_variations::VariationsService::
3775 GetDefaultVariationsServerURLForTesting(); 3776 GetDefaultVariationsServerURLForTesting();
3776 3777
3777 const GURL url = 3778 // g_browser_process->variations_service() is null by default in Chromium
3778 chrome_variations::VariationsService::GetVariationsServerURL( 3779 // builds, so construct a VariationsService locally instead.
3779 g_browser_process->local_state(), std::string()); 3780 scoped_ptr<chrome_variations::VariationsService> service =
bartfab (slow) 2015/09/02 09:57:29 Nit: #include "base/memory/scoped_ptr.h"
blundell 2015/09/02 10:02:18 Done.
3781 chrome_variations::VariationsService::CreateForTesting(
3782 make_scoped_ptr(new ChromeVariationsServiceClient()),
3783 g_browser_process->local_state());
3784
3785 const GURL url = service->GetVariationsServerURL(
3786 g_browser_process->local_state(), std::string());
3780 EXPECT_TRUE(base::StartsWith(url.spec(), default_variations_url, 3787 EXPECT_TRUE(base::StartsWith(url.spec(), default_variations_url,
3781 base::CompareCase::SENSITIVE)); 3788 base::CompareCase::SENSITIVE));
3782 std::string value; 3789 std::string value;
3783 EXPECT_TRUE(net::GetValueForKeyInQuery(url, "restrict", &value)); 3790 EXPECT_TRUE(net::GetValueForKeyInQuery(url, "restrict", &value));
3784 EXPECT_EQ("restricted", value); 3791 EXPECT_EQ("restricted", value);
3785 } 3792 }
3786 3793
3787 IN_PROC_BROWSER_TEST_F(PolicyTest, NativeMessagingBlacklistSelective) { 3794 IN_PROC_BROWSER_TEST_F(PolicyTest, NativeMessagingBlacklistSelective) {
3788 base::ListValue blacklist; 3795 base::ListValue blacklist;
3789 blacklist.Append(new base::StringValue("host.name")); 3796 blacklist.Append(new base::StringValue("host.name"));
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
3856 3863
3857 IN_PROC_BROWSER_TEST_F(HardwareAccelerationModePolicyTest, 3864 IN_PROC_BROWSER_TEST_F(HardwareAccelerationModePolicyTest,
3858 HardwareAccelerationDisabled) { 3865 HardwareAccelerationDisabled) {
3859 // Verifies that hardware acceleration can be disabled with policy. 3866 // Verifies that hardware acceleration can be disabled with policy.
3860 EXPECT_FALSE( 3867 EXPECT_FALSE(
3861 content::GpuDataManager::GetInstance()->GpuAccessAllowed(nullptr)); 3868 content::GpuDataManager::GetInstance()->GpuAccessAllowed(nullptr));
3862 } 3869 }
3863 #endif // !defined(OS_CHROMEOS) && !defined(OS_ANDROID) 3870 #endif // !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
3864 3871
3865 } // namespace policy 3872 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698