| Index: sandbox/win/src/policy_target_test.cc
|
| diff --git a/sandbox/win/src/policy_target_test.cc b/sandbox/win/src/policy_target_test.cc
|
| index 61964f8197e3c1e50b1fe01aca95b6d4b76de5e3..7eaab94c4d62062ce6cd136422e22e1158fae0bb 100644
|
| --- a/sandbox/win/src/policy_target_test.cc
|
| +++ b/sandbox/win/src/policy_target_test.cc
|
| @@ -231,9 +231,9 @@ TEST(PolicyTargetTest, DesktopPolicy) {
|
| BrokerServices* broker = GetBroker();
|
|
|
| // Precreate the desktop.
|
| - TargetPolicy* temp_policy = broker->CreatePolicy();
|
| + scoped_refptr<TargetPolicy> temp_policy = broker->CreatePolicy();
|
| temp_policy->CreateAlternateDesktop(false);
|
| - temp_policy->Release();
|
| + temp_policy = nullptr;
|
|
|
| ASSERT_TRUE(broker != NULL);
|
|
|
| @@ -251,7 +251,7 @@ TEST(PolicyTargetTest, DesktopPolicy) {
|
| DWORD last_error = ERROR_SUCCESS;
|
| base::win::ScopedProcessInformation target;
|
|
|
| - TargetPolicy* policy = broker->CreatePolicy();
|
| + scoped_refptr<TargetPolicy> policy = broker->CreatePolicy();
|
| policy->SetAlternateDesktop(false);
|
| policy->SetTokenLevel(USER_INTERACTIVE, USER_LOCKDOWN);
|
| PROCESS_INFORMATION temp_process_info = {};
|
| @@ -259,7 +259,7 @@ TEST(PolicyTargetTest, DesktopPolicy) {
|
| broker->SpawnTarget(prog_name, arguments.c_str(), policy, &warning_result,
|
| &last_error, &temp_process_info);
|
| base::string16 desktop_name = policy->GetAlternateDesktop();
|
| - policy->Release();
|
| + policy = nullptr;
|
|
|
| EXPECT_EQ(SBOX_ALL_OK, result);
|
| if (result == SBOX_ALL_OK)
|
| @@ -283,7 +283,7 @@ TEST(PolicyTargetTest, DesktopPolicy) {
|
| // Close the desktop handle.
|
| temp_policy = broker->CreatePolicy();
|
| temp_policy->DestroyAlternateDesktop();
|
| - temp_policy->Release();
|
| + temp_policy = nullptr;
|
|
|
| // Make sure the desktop does not exist anymore.
|
| desk = ::OpenDesktop(desktop_name.c_str(), 0, FALSE, DESKTOP_ENUMERATE);
|
| @@ -298,9 +298,9 @@ TEST(PolicyTargetTest, WinstaPolicy) {
|
| BrokerServices* broker = GetBroker();
|
|
|
| // Precreate the desktop.
|
| - TargetPolicy* temp_policy = broker->CreatePolicy();
|
| + scoped_refptr<TargetPolicy> temp_policy = broker->CreatePolicy();
|
| temp_policy->CreateAlternateDesktop(true);
|
| - temp_policy->Release();
|
| + temp_policy = nullptr;
|
|
|
| ASSERT_TRUE(broker != NULL);
|
|
|
| @@ -317,7 +317,7 @@ TEST(PolicyTargetTest, WinstaPolicy) {
|
| ResultCode warning_result = SBOX_ALL_OK;
|
| base::win::ScopedProcessInformation target;
|
|
|
| - TargetPolicy* policy = broker->CreatePolicy();
|
| + scoped_refptr<TargetPolicy> policy = broker->CreatePolicy();
|
| policy->SetAlternateDesktop(true);
|
| policy->SetTokenLevel(USER_INTERACTIVE, USER_LOCKDOWN);
|
| PROCESS_INFORMATION temp_process_info = {};
|
| @@ -326,7 +326,7 @@ TEST(PolicyTargetTest, WinstaPolicy) {
|
| broker->SpawnTarget(prog_name, arguments.c_str(), policy, &warning_result,
|
| &last_error, &temp_process_info);
|
| base::string16 desktop_name = policy->GetAlternateDesktop();
|
| - policy->Release();
|
| + policy = nullptr;
|
|
|
| EXPECT_EQ(SBOX_ALL_OK, result);
|
| if (result == SBOX_ALL_OK)
|
| @@ -358,7 +358,7 @@ TEST(PolicyTargetTest, WinstaPolicy) {
|
| // Close the desktop handle.
|
| temp_policy = broker->CreatePolicy();
|
| temp_policy->DestroyAlternateDesktop();
|
| - temp_policy->Release();
|
| + temp_policy = nullptr;
|
| }
|
|
|
| // Launches the app in the sandbox and share a handle with it. The app should
|
| @@ -386,7 +386,7 @@ TEST(PolicyTargetTest, ShareHandleTest) {
|
| wchar_t prog_name[MAX_PATH];
|
| GetModuleFileNameW(NULL, prog_name, MAX_PATH);
|
|
|
| - TargetPolicy* policy = broker->CreatePolicy();
|
| + scoped_refptr<TargetPolicy> policy = broker->CreatePolicy();
|
| policy->AddHandleToShare(read_only_view.handle().GetHandle());
|
|
|
| base::string16 arguments(L"\"");
|
| @@ -406,7 +406,7 @@ TEST(PolicyTargetTest, ShareHandleTest) {
|
| result =
|
| broker->SpawnTarget(prog_name, arguments.c_str(), policy, &warning_result,
|
| &last_error, &temp_process_info);
|
| - policy->Release();
|
| + policy = nullptr;
|
|
|
| EXPECT_EQ(SBOX_ALL_OK, result);
|
| if (result == SBOX_ALL_OK)
|
|
|