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

Side by Side Diff: sandbox/win/src/app_container_unittest.cc

Issue 1849323003: Convert //sandbox to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixup nonsfi_sandbox_unittest.cc 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
« no previous file with comments | « sandbox/win/src/app_container.cc ('k') | sandbox/win/src/broker_services.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <memory>
6
5 #include "base/win/windows_version.h" 7 #include "base/win/windows_version.h"
6 #include "sandbox/win/src/app_container.h" 8 #include "sandbox/win/src/app_container.h"
7 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
8 10
9 namespace sandbox { 11 namespace sandbox {
10 12
11 // Tests the low level AppContainer interface. 13 // Tests the low level AppContainer interface.
12 TEST(AppContainerTest, CreateAppContainer) { 14 TEST(AppContainerTest, CreateAppContainer) {
13 if (base::win::OSInfo::GetInstance()->version() < base::win::VERSION_WIN8) 15 if (base::win::OSInfo::GetInstance()->version() < base::win::VERSION_WIN8)
14 return; 16 return;
(...skipping 14 matching lines...) Expand all
29 31
30 EXPECT_EQ(SBOX_ERROR_INVALID_APP_CONTAINER, 32 EXPECT_EQ(SBOX_ERROR_INVALID_APP_CONTAINER,
31 CreateAppContainer(L"Foo", kName)); 33 CreateAppContainer(L"Foo", kName));
32 } 34 }
33 35
34 // Tests handling of security capabilities on the attribute list. 36 // Tests handling of security capabilities on the attribute list.
35 TEST(AppContainerTest, SecurityCapabilities) { 37 TEST(AppContainerTest, SecurityCapabilities) {
36 if (base::win::OSInfo::GetInstance()->version() < base::win::VERSION_WIN8) 38 if (base::win::OSInfo::GetInstance()->version() < base::win::VERSION_WIN8)
37 return; 39 return;
38 40
39 scoped_ptr<AppContainerAttributes> attributes(new AppContainerAttributes); 41 std::unique_ptr<AppContainerAttributes> attributes(
42 new AppContainerAttributes);
40 std::vector<base::string16> capabilities; 43 std::vector<base::string16> capabilities;
41 EXPECT_EQ(SBOX_ERROR_INVALID_APP_CONTAINER, 44 EXPECT_EQ(SBOX_ERROR_INVALID_APP_CONTAINER,
42 attributes->SetAppContainer(L"S-1-foo", capabilities)); 45 attributes->SetAppContainer(L"S-1-foo", capabilities));
43 46
44 EXPECT_EQ(SBOX_ALL_OK, 47 EXPECT_EQ(SBOX_ALL_OK,
45 attributes->SetAppContainer(L"S-1-15-2-12345-234", capabilities)); 48 attributes->SetAppContainer(L"S-1-15-2-12345-234", capabilities));
46 EXPECT_TRUE(attributes->HasAppContainer()); 49 EXPECT_TRUE(attributes->HasAppContainer());
47 50
48 attributes.reset(new AppContainerAttributes); 51 attributes.reset(new AppContainerAttributes);
49 capabilities.push_back(L"S-1-15-3-12345678-87654321"); 52 capabilities.push_back(L"S-1-15-3-12345678-87654321");
50 capabilities.push_back(L"S-1-15-3-1"); 53 capabilities.push_back(L"S-1-15-3-1");
51 capabilities.push_back(L"S-1-15-3-2"); 54 capabilities.push_back(L"S-1-15-3-2");
52 capabilities.push_back(L"S-1-15-3-3"); 55 capabilities.push_back(L"S-1-15-3-3");
53 EXPECT_EQ(SBOX_ALL_OK, 56 EXPECT_EQ(SBOX_ALL_OK,
54 attributes->SetAppContainer(L"S-1-15-2-1-2", capabilities)); 57 attributes->SetAppContainer(L"S-1-15-2-1-2", capabilities));
55 EXPECT_TRUE(attributes->HasAppContainer()); 58 EXPECT_TRUE(attributes->HasAppContainer());
56 } 59 }
57 60
58 } // namespace sandbox 61 } // namespace sandbox
OLDNEW
« no previous file with comments | « sandbox/win/src/app_container.cc ('k') | sandbox/win/src/broker_services.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698