| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/scoped_handle_win.h" | 5 #include "base/scoped_handle_win.h" |
| 6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
| 7 #include "sandbox/src/sandbox.h" | 7 #include "sandbox/src/sandbox.h" |
| 8 #include "sandbox/src/sandbox_factory.h" | 8 #include "sandbox/src/sandbox_factory.h" |
| 9 #include "sandbox/src/target_services.h" | 9 #include "sandbox/src/target_services.h" |
| 10 #include "sandbox/tests/common/controller.h" | 10 #include "sandbox/tests/common/controller.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 TEST(UnloadDllTest, UnloadAviCapDllNoPatching) { | 58 TEST(UnloadDllTest, UnloadAviCapDllNoPatching) { |
| 59 TestRunner runner; | 59 TestRunner runner; |
| 60 runner.SetTestState(BEFORE_REVERT); | 60 runner.SetTestState(BEFORE_REVERT); |
| 61 runner.SetTimeout(2000); | 61 runner.SetTimeout(2000); |
| 62 sandbox::TargetPolicy* policy = runner.GetPolicy(); | 62 sandbox::TargetPolicy* policy = runner.GetPolicy(); |
| 63 policy->AddDllToUnload(L"avicap32.dll"); | 63 policy->AddDllToUnload(L"avicap32.dll"); |
| 64 EXPECT_EQ(SBOX_TEST_FAILED, runner.RunTest(L"UseOneDLL L avicap32.dll")); | 64 EXPECT_EQ(SBOX_TEST_FAILED, runner.RunTest(L"UseOneDLL L avicap32.dll")); |
| 65 EXPECT_EQ(SBOX_TEST_FAILED, runner.RunTest(L"UseOneDLL B avicap32.dll")); | 65 EXPECT_EQ(SBOX_TEST_FAILED, runner.RunTest(L"UseOneDLL B avicap32.dll")); |
| 66 } | 66 } |
| 67 | 67 |
| 68 // Flaky: http://crbug.com/38404 |
| 68 TEST(UnloadDllTest, FLAKY_UnloadAviCapDllWithPatching) { | 69 TEST(UnloadDllTest, FLAKY_UnloadAviCapDllWithPatching) { |
| 69 TestRunner runner; | 70 TestRunner runner; |
| 70 runner.SetTimeout(2000); | 71 runner.SetTimeout(2000); |
| 71 runner.SetTestState(BEFORE_REVERT); | 72 runner.SetTestState(BEFORE_REVERT); |
| 72 sandbox::TargetPolicy* policy = runner.GetPolicy(); | 73 sandbox::TargetPolicy* policy = runner.GetPolicy(); |
| 73 policy->AddDllToUnload(L"avicap32.dll"); | 74 policy->AddDllToUnload(L"avicap32.dll"); |
| 74 | 75 |
| 75 ScopedHandle handle1(::CreateEvent(NULL, FALSE, FALSE, L"tst0001")); | 76 ScopedHandle handle1(::CreateEvent(NULL, FALSE, FALSE, L"tst0001")); |
| 76 | 77 |
| 77 // Add a couple of rules that ensures that the interception agent add EAT | 78 // Add a couple of rules that ensures that the interception agent add EAT |
| 78 // patching on the client which makes sure that the unload dll record does | 79 // patching on the client which makes sure that the unload dll record does |
| 79 // not interact badly with them. | 80 // not interact badly with them. |
| 80 EXPECT_TRUE(runner.AddRule(TargetPolicy::SUBSYS_REGISTRY, | 81 EXPECT_TRUE(runner.AddRule(TargetPolicy::SUBSYS_REGISTRY, |
| 81 TargetPolicy::REG_ALLOW_ANY, | 82 TargetPolicy::REG_ALLOW_ANY, |
| 82 L"HKEY_LOCAL_MACHINE\\Software\\Microsoft")); | 83 L"HKEY_LOCAL_MACHINE\\Software\\Microsoft")); |
| 83 EXPECT_TRUE(runner.AddRule(TargetPolicy::SUBSYS_SYNC, | 84 EXPECT_TRUE(runner.AddRule(TargetPolicy::SUBSYS_SYNC, |
| 84 TargetPolicy::EVENTS_ALLOW_ANY, L"tst0001")); | 85 TargetPolicy::EVENTS_ALLOW_ANY, L"tst0001")); |
| 85 | 86 |
| 86 EXPECT_EQ(SBOX_TEST_FAILED, runner.RunTest(L"UseOneDLL L avicap32.dll")); | 87 EXPECT_EQ(SBOX_TEST_FAILED, runner.RunTest(L"UseOneDLL L avicap32.dll")); |
| 87 | 88 |
| 88 runner.SetTestState(AFTER_REVERT); | 89 runner.SetTestState(AFTER_REVERT); |
| 89 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"SimpleOpenEvent tst0001")); | 90 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"SimpleOpenEvent tst0001")); |
| 90 } | 91 } |
| 91 | 92 |
| 92 } // namespace sandbox | 93 } // namespace sandbox |
| OLD | NEW |