OLD | NEW |
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 "base/win/windows_version.h" | 5 #include "base/win/windows_version.h" |
6 #include "sandbox/win/src/app_container.h" | 6 #include "sandbox/win/src/app_container.h" |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 | 8 |
9 namespace sandbox { | 9 namespace sandbox { |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 EXPECT_EQ(SBOX_ERROR_INVALID_APP_CONTAINER, | 30 EXPECT_EQ(SBOX_ERROR_INVALID_APP_CONTAINER, |
31 CreateAppContainer(L"Foo", kName)); | 31 CreateAppContainer(L"Foo", kName)); |
32 } | 32 } |
33 | 33 |
34 // Tests handling of security capabilities on the attribute list. | 34 // Tests handling of security capabilities on the attribute list. |
35 TEST(AppContainerTest, SecurityCapabilities) { | 35 TEST(AppContainerTest, SecurityCapabilities) { |
36 if (base::win::OSInfo::GetInstance()->version() < base::win::VERSION_WIN8) | 36 if (base::win::OSInfo::GetInstance()->version() < base::win::VERSION_WIN8) |
37 return; | 37 return; |
38 | 38 |
39 scoped_ptr<AppContainerAttributes> attributes(new AppContainerAttributes); | 39 scoped_ptr<AppContainerAttributes> attributes(new AppContainerAttributes); |
40 std::vector<string16> capabilities; | 40 std::vector<base::string16> capabilities; |
41 EXPECT_EQ(SBOX_ERROR_INVALID_APP_CONTAINER, | 41 EXPECT_EQ(SBOX_ERROR_INVALID_APP_CONTAINER, |
42 attributes->SetAppContainer(L"S-1-foo", capabilities)); | 42 attributes->SetAppContainer(L"S-1-foo", capabilities)); |
43 | 43 |
44 EXPECT_EQ(SBOX_ALL_OK, | 44 EXPECT_EQ(SBOX_ALL_OK, |
45 attributes->SetAppContainer(L"S-1-15-2-12345-234", capabilities)); | 45 attributes->SetAppContainer(L"S-1-15-2-12345-234", capabilities)); |
46 EXPECT_TRUE(attributes->HasAppContainer()); | 46 EXPECT_TRUE(attributes->HasAppContainer()); |
47 | 47 |
48 attributes.reset(new AppContainerAttributes); | 48 attributes.reset(new AppContainerAttributes); |
49 capabilities.push_back(L"S-1-15-3-12345678-87654321"); | 49 capabilities.push_back(L"S-1-15-3-12345678-87654321"); |
50 capabilities.push_back(L"S-1-15-3-1"); | 50 capabilities.push_back(L"S-1-15-3-1"); |
51 capabilities.push_back(L"S-1-15-3-2"); | 51 capabilities.push_back(L"S-1-15-3-2"); |
52 capabilities.push_back(L"S-1-15-3-3"); | 52 capabilities.push_back(L"S-1-15-3-3"); |
53 EXPECT_EQ(SBOX_ALL_OK, | 53 EXPECT_EQ(SBOX_ALL_OK, |
54 attributes->SetAppContainer(L"S-1-15-2-1-2", capabilities)); | 54 attributes->SetAppContainer(L"S-1-15-2-1-2", capabilities)); |
55 EXPECT_TRUE(attributes->HasAppContainer()); | 55 EXPECT_TRUE(attributes->HasAppContainer()); |
56 } | 56 } |
57 | 57 |
58 } // namespace sandbox | 58 } // namespace sandbox |
OLD | NEW |