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

Side by Side Diff: chrome/browser/chromeos/policy/variations_service_policy_browsertest.cc

Issue 1870793002: Convert //chrome/browser/chromeos from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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) 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>
6
5 #include "base/macros.h" 7 #include "base/macros.h"
6 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/ptr_util.h"
7 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
8 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/chromeos/policy/device_policy_builder.h" 11 #include "chrome/browser/chromeos/policy/device_policy_builder.h"
10 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" 12 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h"
11 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" 13 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h"
12 #include "chrome/browser/metrics/variations/chrome_variations_service_client.h" 14 #include "chrome/browser/metrics/variations/chrome_variations_service_client.h"
13 #include "chrome/test/base/testing_browser_process.h" 15 #include "chrome/test/base/testing_browser_process.h"
14 #include "components/variations/service/variations_service.h" 16 #include "components/variations/service/variations_service.h"
15 #include "net/base/url_util.h" 17 #include "net/base/url_util.h"
16 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 22 matching lines...) Expand all
39 private: 41 private:
40 DISALLOW_COPY_AND_ASSIGN(VariationsServiceDevicePolicyTest); 42 DISALLOW_COPY_AND_ASSIGN(VariationsServiceDevicePolicyTest);
41 }; 43 };
42 44
43 IN_PROC_BROWSER_TEST_F(VariationsServiceDevicePolicyTest, VariationsURLValid) { 45 IN_PROC_BROWSER_TEST_F(VariationsServiceDevicePolicyTest, VariationsURLValid) {
44 const std::string default_variations_url = 46 const std::string default_variations_url =
45 variations::VariationsService::GetDefaultVariationsServerURLForTesting(); 47 variations::VariationsService::GetDefaultVariationsServerURLForTesting();
46 48
47 // g_browser_process->variations_service() is null by default in Chromium 49 // g_browser_process->variations_service() is null by default in Chromium
48 // builds, so construct a VariationsService locally instead. 50 // builds, so construct a VariationsService locally instead.
49 scoped_ptr<variations::VariationsService> service = 51 std::unique_ptr<variations::VariationsService> service =
50 variations::VariationsService::CreateForTesting( 52 variations::VariationsService::CreateForTesting(
51 make_scoped_ptr(new ChromeVariationsServiceClient()), 53 base::WrapUnique(new ChromeVariationsServiceClient()),
52 g_browser_process->local_state()); 54 g_browser_process->local_state());
53 55
54 // Device policy has updated the cros settings. 56 // Device policy has updated the cros settings.
55 const GURL url = service->GetVariationsServerURL( 57 const GURL url = service->GetVariationsServerURL(
56 g_browser_process->local_state(), std::string()); 58 g_browser_process->local_state(), std::string());
57 EXPECT_TRUE(base::StartsWith(url.spec(), default_variations_url, 59 EXPECT_TRUE(base::StartsWith(url.spec(), default_variations_url,
58 base::CompareCase::SENSITIVE)); 60 base::CompareCase::SENSITIVE));
59 std::string value; 61 std::string value;
60 EXPECT_TRUE(net::GetValueForKeyInQuery(url, "restrict", &value)); 62 EXPECT_TRUE(net::GetValueForKeyInQuery(url, "restrict", &value));
61 EXPECT_EQ("restricted", value); 63 EXPECT_EQ("restricted", value);
62 } 64 }
63 65
64 } // namespace policy 66 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/policy/user_policy_test_helper.cc ('k') | chrome/browser/chromeos/policy/wildcard_login_checker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698