Chromium Code Reviews| Index: sandbox/win/src/lpc_policy_test.cc |
| diff --git a/sandbox/win/src/lpc_policy_test.cc b/sandbox/win/src/lpc_policy_test.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..3e78096dbe48e091e22564d08c11f4acfc3f62fa |
| --- /dev/null |
| +++ b/sandbox/win/src/lpc_policy_test.cc |
| @@ -0,0 +1,62 @@ |
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +// These tests have been added to specifically tests issues arising from (A)LPC |
| +// lock down. |
| + |
| +#include <algorithm> |
| +#include <cctype> |
| + |
| +#include <windows.h> |
| +#include <winioctl.h> |
| + |
| +#include "sandbox/win/src/sandbox.h" |
| +#include "sandbox/win/src/sandbox_factory.h" |
| +#include "sandbox/win/src/sandbox_policy.h" |
| +#include "sandbox/win/tests/common/controller.h" |
| +#include "sandbox/win/tests/common/test_utils.h" |
| +#include "testing/gtest/include/gtest/gtest.h" |
| + |
| +namespace sandbox { |
| + |
| +SBOX_TESTS_COMMAND int Lpc_GetUserDefaultLangID(int argc, wchar_t **argv) { |
| + ::GetUserDefaultLangID(); |
|
Will Harris
2015/09/03 20:58:03
is there a way of verifying the return value here
|
| + return SBOX_TEST_SUCCEEDED; |
| +} |
| + |
| +TEST(LpcPolicyTest, GetUserDefaultLangID) { |
| + TestRunner runner; |
| + EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"Lpc_GetUserDefaultLangID")); |
| +} |
| + |
| +SBOX_TESTS_COMMAND int Lpc_GetUserDefaultLCID(int argc, wchar_t **argv) { |
| + ::GetUserDefaultLCID(); |
| + return SBOX_TEST_SUCCEEDED; |
| +} |
| + |
| +TEST(LpcPolicyTest, GetUserDefaultLCID) { |
| + TestRunner runner; |
| + EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"Lpc_GetUserDefaultLCID")); |
| +} |
| + |
| +SBOX_TESTS_COMMAND int Lpc_GetUserDefaultLocaleName(int argc, wchar_t **argv) { |
| + wchar_t localeName[LOCALE_NAME_MAX_LENGTH] = { 0 }; |
| + int ret = ::GetUserDefaultLocaleName( |
| + localeName, LOCALE_NAME_MAX_LENGTH * sizeof(wchar_t)); |
| + if (!ret) { |
| + return SBOX_TEST_FAILED; |
| + } |
| + if (!wcsnlen(localeName, LOCALE_NAME_MAX_LENGTH)) { |
| + return SBOX_TEST_FAILED; |
| + } |
| + return SBOX_TEST_SUCCEEDED; |
| +} |
| + |
| +TEST(LpcPolicyTest, GetUserDefaultLocaleName) { |
| + TestRunner runner; |
| + EXPECT_EQ(SBOX_TEST_SUCCEEDED, |
| + runner.RunTest(L"Lpc_GetUserDefaultLocaleName")); |
| +} |
| + |
| +} // namespace sandbox |