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

Side by Side Diff: chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_apitest_nss.cc

Issue 1871713002: Convert //chrome/browser/extensions from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and fix header 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <cryptohi.h> 5 #include <cryptohi.h>
6 #include <stddef.h> 6 #include <stddef.h>
7 7
8 #include <memory>
9
8 #include "base/macros.h" 10 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/path_service.h" 11 #include "base/path_service.h"
11 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
12 #include "chrome/browser/browser_process.h" 13 #include "chrome/browser/browser_process.h"
13 #include "chrome/browser/chromeos/login/test/https_forwarder.h" 14 #include "chrome/browser/chromeos/login/test/https_forwarder.h"
14 #include "chrome/browser/chromeos/login/ui/login_display_host.h" 15 #include "chrome/browser/chromeos/login/ui/login_display_host.h"
15 #include "chrome/browser/chromeos/policy/affiliation_test_helper.h" 16 #include "chrome/browser/chromeos/policy/affiliation_test_helper.h"
16 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" 17 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h"
17 #include "chrome/browser/extensions/extension_apitest.h" 18 #include "chrome/browser/extensions/extension_apitest.h"
18 #include "chrome/browser/net/nss_context.h" 19 #include "chrome/browser/net/nss_context.h"
19 #include "chrome/browser/net/url_request_mock_util.h" 20 #include "chrome/browser/net/url_request_mock_util.h"
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 } 246 }
246 247
247 void SetUpInProcessBrowserTestFixture() override { 248 void SetUpInProcessBrowserTestFixture() override {
248 ExtensionApiTest::SetUpInProcessBrowserTestFixture(); 249 ExtensionApiTest::SetUpInProcessBrowserTestFixture();
249 250
250 host_resolver()->AddRule("*", "127.0.0.1"); 251 host_resolver()->AddRule("*", "127.0.0.1");
251 252
252 chromeos::FakeSessionManagerClient* fake_session_manager_client = 253 chromeos::FakeSessionManagerClient* fake_session_manager_client =
253 new chromeos::FakeSessionManagerClient; 254 new chromeos::FakeSessionManagerClient;
254 chromeos::DBusThreadManager::GetSetterForTesting()->SetSessionManagerClient( 255 chromeos::DBusThreadManager::GetSetterForTesting()->SetSessionManagerClient(
255 scoped_ptr<chromeos::SessionManagerClient>( 256 std::unique_ptr<chromeos::SessionManagerClient>(
256 fake_session_manager_client)); 257 fake_session_manager_client));
257 258
258 if (GetParam().device_status_ == DEVICE_STATUS_ENROLLED) { 259 if (GetParam().device_status_ == DEVICE_STATUS_ENROLLED) {
259 std::set<std::string> device_affiliation_ids; 260 std::set<std::string> device_affiliation_ids;
260 device_affiliation_ids.insert(kAffiliationID); 261 device_affiliation_ids.insert(kAffiliationID);
261 policy::affiliation_test_helper::SetDeviceAffiliationID( 262 policy::affiliation_test_helper::SetDeviceAffiliationID(
262 &device_policy_test_helper_, fake_session_manager_client, 263 &device_policy_test_helper_, fake_session_manager_client,
263 device_affiliation_ids); 264 device_affiliation_ids);
264 } 265 }
265 266
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 354
354 void SetPolicy() { 355 void SetPolicy() {
355 // Extensions that are force-installed come from an update URL, which 356 // Extensions that are force-installed come from an update URL, which
356 // defaults to the webstore. Use a mock URL for this test with an update 357 // defaults to the webstore. Use a mock URL for this test with an update
357 // manifest that includes the crx file of the test extension. 358 // manifest that includes the crx file of the test extension.
358 base::FilePath update_manifest_path = 359 base::FilePath update_manifest_path =
359 base::FilePath(kTestExtensionDir).Append(kUpdateManifestFileName); 360 base::FilePath(kTestExtensionDir).Append(kUpdateManifestFileName);
360 GURL update_manifest_url(net::URLRequestMockHTTPJob::GetMockUrl( 361 GURL update_manifest_url(net::URLRequestMockHTTPJob::GetMockUrl(
361 update_manifest_path.MaybeAsASCII())); 362 update_manifest_path.MaybeAsASCII()));
362 363
363 scoped_ptr<base::ListValue> forcelist(new base::ListValue); 364 std::unique_ptr<base::ListValue> forcelist(new base::ListValue);
364 forcelist->AppendString(base::StringPrintf( 365 forcelist->AppendString(base::StringPrintf(
365 "%s;%s", kTestExtensionID, update_manifest_url.spec().c_str())); 366 "%s;%s", kTestExtensionID, update_manifest_url.spec().c_str()));
366 367
367 policy::PolicyMap policy; 368 policy::PolicyMap policy;
368 policy.Set(policy::key::kExtensionInstallForcelist, 369 policy.Set(policy::key::kExtensionInstallForcelist,
369 policy::POLICY_LEVEL_MANDATORY, 370 policy::POLICY_LEVEL_MANDATORY,
370 policy::POLICY_SCOPE_MACHINE, 371 policy::POLICY_SCOPE_MACHINE,
371 policy::POLICY_SOURCE_CLOUD, 372 policy::POLICY_SOURCE_CLOUD,
372 forcelist.release(), 373 forcelist.release(),
373 NULL); 374 NULL);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 } 420 }
420 421
421 void TearDownTestSystemSlotOnIO(const base::Closure& done_callback) { 422 void TearDownTestSystemSlotOnIO(const base::Closure& done_callback) {
422 test_system_slot_.reset(); 423 test_system_slot_.reset();
423 424
424 content::BrowserThread::PostTask( 425 content::BrowserThread::PostTask(
425 content::BrowserThread::UI, FROM_HERE, done_callback); 426 content::BrowserThread::UI, FROM_HERE, done_callback);
426 } 427 }
427 428
428 policy::DevicePolicyCrosTestHelper device_policy_test_helper_; 429 policy::DevicePolicyCrosTestHelper device_policy_test_helper_;
429 scoped_ptr<crypto::ScopedTestSystemNSSKeySlot> test_system_slot_; 430 std::unique_ptr<crypto::ScopedTestSystemNSSKeySlot> test_system_slot_;
430 policy::MockConfigurationPolicyProvider policy_provider_; 431 policy::MockConfigurationPolicyProvider policy_provider_;
431 FakeGaia fake_gaia_; 432 FakeGaia fake_gaia_;
432 chromeos::HTTPSForwarder gaia_https_forwarder_; 433 chromeos::HTTPSForwarder gaia_https_forwarder_;
433 }; 434 };
434 435
435 } // namespace 436 } // namespace
436 437
437 IN_PROC_BROWSER_TEST_P(EnterprisePlatformKeysTest, PRE_Basic) { 438 IN_PROC_BROWSER_TEST_P(EnterprisePlatformKeysTest, PRE_Basic) {
438 policy::affiliation_test_helper::PreLoginUser(kEnterpriseUser); 439 policy::affiliation_test_helper::PreLoginUser(kEnterpriseUser);
439 } 440 }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 extensions::ExtensionRegistry* registry = 511 extensions::ExtensionRegistry* registry =
511 extensions::ExtensionRegistry::Get(profile()); 512 extensions::ExtensionRegistry::Get(profile());
512 const extensions::Extension* extension = 513 const extensions::Extension* extension =
513 GetExtensionByPath(registry->enabled_extensions(), extension_path); 514 GetExtensionByPath(registry->enabled_extensions(), extension_path);
514 ASSERT_FALSE(extension->install_warnings().empty()); 515 ASSERT_FALSE(extension->install_warnings().empty());
515 EXPECT_EQ( 516 EXPECT_EQ(
516 "'enterprise.platformKeys' is not allowed for specified install " 517 "'enterprise.platformKeys' is not allowed for specified install "
517 "location.", 518 "location.",
518 extension->install_warnings()[0].message); 519 extension->install_warnings()[0].message);
519 } 520 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698