| 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 <memory> | 5 #include <memory> |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 IN_PROC_BROWSER_TEST_F(VariationsServiceDevicePolicyTest, VariationsURLValid) { | 45 IN_PROC_BROWSER_TEST_F(VariationsServiceDevicePolicyTest, VariationsURLValid) { |
| 46 const std::string default_variations_url = | 46 const std::string default_variations_url = |
| 47 variations::VariationsService::GetDefaultVariationsServerURLForTesting(); | 47 variations::VariationsService::GetDefaultVariationsServerURLForTesting(); |
| 48 | 48 |
| 49 // g_browser_process->variations_service() is null by default in Chromium | 49 // g_browser_process->variations_service() is null by default in Chromium |
| 50 // builds, so construct a VariationsService locally instead. | 50 // builds, so construct a VariationsService locally instead. |
| 51 std::unique_ptr<variations::VariationsService> service = | 51 std::unique_ptr<variations::VariationsService> service = |
| 52 variations::VariationsService::CreateForTesting( | 52 variations::VariationsService::CreateForTesting( |
| 53 base::WrapUnique(new ChromeVariationsServiceClient()), | 53 base::MakeUnique<ChromeVariationsServiceClient>(), |
| 54 g_browser_process->local_state()); | 54 g_browser_process->local_state()); |
| 55 | 55 |
| 56 // Device policy has updated the cros settings. | 56 // Device policy has updated the cros settings. |
| 57 const GURL url = service->GetVariationsServerURL( | 57 const GURL url = service->GetVariationsServerURL( |
| 58 g_browser_process->local_state(), std::string()); | 58 g_browser_process->local_state(), std::string()); |
| 59 EXPECT_TRUE(base::StartsWith(url.spec(), default_variations_url, | 59 EXPECT_TRUE(base::StartsWith(url.spec(), default_variations_url, |
| 60 base::CompareCase::SENSITIVE)); | 60 base::CompareCase::SENSITIVE)); |
| 61 std::string value; | 61 std::string value; |
| 62 EXPECT_TRUE(net::GetValueForKeyInQuery(url, "restrict", &value)); | 62 EXPECT_TRUE(net::GetValueForKeyInQuery(url, "restrict", &value)); |
| 63 EXPECT_EQ("restricted", value); | 63 EXPECT_EQ("restricted", value); |
| 64 } | 64 } |
| 65 | 65 |
| 66 } // namespace policy | 66 } // namespace policy |
| OLD | NEW |