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 // This file contains unit tests for the RestrictedToken. | 5 // This file contains unit tests for the RestrictedToken. |
6 | 6 |
7 #define _ATL_NO_EXCEPTIONS | 7 #define _ATL_NO_EXCEPTIONS |
8 #include <atlbase.h> | 8 #include <atlbase.h> |
9 #include <atlsecurity.h> | 9 #include <atlsecurity.h> |
10 #include <vector> | 10 #include <vector> |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 ASSERT_TRUE(restricted_token.GetPrivileges(&privileges)); | 346 ASSERT_TRUE(restricted_token.GetPrivileges(&privileges)); |
347 | 347 |
348 ASSERT_EQ(0, privileges.GetCount()); | 348 ASSERT_EQ(0, privileges.GetCount()); |
349 } | 349 } |
350 | 350 |
351 // Tests the method DeleteAllPrivileges with an exception list. | 351 // Tests the method DeleteAllPrivileges with an exception list. |
352 TEST(RestrictedTokenTest, DeleteAllPrivilegesException) { | 352 TEST(RestrictedTokenTest, DeleteAllPrivilegesException) { |
353 RestrictedToken token; | 353 RestrictedToken token; |
354 HANDLE token_handle = NULL; | 354 HANDLE token_handle = NULL; |
355 | 355 |
356 std::vector<std::wstring> exceptions; | 356 std::vector<base::string16> exceptions; |
357 exceptions.push_back(SE_CHANGE_NOTIFY_NAME); | 357 exceptions.push_back(SE_CHANGE_NOTIFY_NAME); |
358 | 358 |
359 ASSERT_EQ(ERROR_SUCCESS, token.Init(NULL)); | 359 ASSERT_EQ(ERROR_SUCCESS, token.Init(NULL)); |
360 ASSERT_EQ(ERROR_SUCCESS, token.DeleteAllPrivileges(&exceptions)); | 360 ASSERT_EQ(ERROR_SUCCESS, token.DeleteAllPrivileges(&exceptions)); |
361 ASSERT_EQ(ERROR_SUCCESS, token.GetRestrictedTokenHandle(&token_handle)); | 361 ASSERT_EQ(ERROR_SUCCESS, token.GetRestrictedTokenHandle(&token_handle)); |
362 | 362 |
363 ATL::CAccessToken restricted_token; | 363 ATL::CAccessToken restricted_token; |
364 restricted_token.Attach(token_handle); | 364 restricted_token.Attach(token_handle); |
365 | 365 |
366 ATL::CTokenPrivileges privileges; | 366 ATL::CTokenPrivileges privileges; |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 TEST(RestrictedTokenTest, DoubleInit) { | 584 TEST(RestrictedTokenTest, DoubleInit) { |
585 RestrictedToken token; | 585 RestrictedToken token; |
586 ASSERT_EQ(ERROR_SUCCESS, token.Init(NULL)); | 586 ASSERT_EQ(ERROR_SUCCESS, token.Init(NULL)); |
587 | 587 |
588 ASSERT_EQ(ERROR_ALREADY_INITIALIZED, token.Init(NULL)); | 588 ASSERT_EQ(ERROR_ALREADY_INITIALIZED, token.Init(NULL)); |
589 } | 589 } |
590 | 590 |
591 #endif | 591 #endif |
592 | 592 |
593 } // namespace sandbox | 593 } // namespace sandbox |
OLD | NEW |