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

Side by Side Diff: test/win/win_multiprocess_test.cc

Issue 1164683005: win: fix uncaught multiprocess child test failures (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: 0 -> EXIT_SUCCESS Created 5 years, 6 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 | « test/win/win_multiprocess.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Crashpad Authors. All rights reserved. 1 // Copyright 2015 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 23 matching lines...) Expand all
34 34
35 void WinMultiprocessChild() override { 35 void WinMultiprocessChild() override {
36 exit(exit_code_); 36 exit(exit_code_);
37 } 37 }
38 38
39 unsigned int exit_code_; 39 unsigned int exit_code_;
40 40
41 DISALLOW_COPY_AND_ASSIGN(TestWinMultiprocess); 41 DISALLOW_COPY_AND_ASSIGN(TestWinMultiprocess);
42 }; 42 };
43 43
44 enum class FailureType {
45 kExpect,
46 kAssert,
47 };
48
49 class TestWinMultiprocessChildFails final : public WinMultiprocess {
50 public:
51 explicit TestWinMultiprocessChildFails(FailureType failure_type)
52 : WinMultiprocess(), failure_type_(failure_type) {}
53 ~TestWinMultiprocessChildFails() {}
54
55 private:
56 void WinMultiprocessParent() override {}
57 void WinMultiprocessChild() override {
58 switch (failure_type_) {
59 case FailureType::kExpect:
60 EXPECT_FALSE(true);
61 break;
62 case FailureType::kAssert:
63 ASSERT_FALSE(true);
64 break;
65 }
66 }
67
68 FailureType failure_type_;
69
70 DISALLOW_COPY_AND_ASSIGN(TestWinMultiprocessChildFails);
71 };
72
73
44 TEST(WinMultiprocess, WinMultiprocess) { 74 TEST(WinMultiprocess, WinMultiprocess) {
45 TestWinMultiprocess win_multiprocess(0); 75 TestWinMultiprocess win_multiprocess(0);
46 win_multiprocess.Run(); 76 win_multiprocess.Run();
47 } 77 }
48 78
49 TEST(WinMultiprocess, WinMultiprocessNonSuccessExitCode) { 79 TEST(WinMultiprocess, WinMultiprocessNonSuccessExitCode) {
50 TestWinMultiprocess win_multiprocess(100); 80 TestWinMultiprocess win_multiprocess(100);
51 win_multiprocess.SetExpectedChildExitCode(100); 81 win_multiprocess.SetExpectedChildExitCode(100);
52 win_multiprocess.Run(); 82 win_multiprocess.Run();
53 } 83 }
54 84
85 TEST(WinMultiprocessChildFails, ChildExpectFailure) {
86 TestWinMultiprocessChildFails multiprocess_failing_child(
87 FailureType::kExpect);
88 multiprocess_failing_child.SetExpectedChildExitCode(255);
89 multiprocess_failing_child.Run();
90 }
91
92 TEST(WinMultiprocessChildFails, ChildAssertFailure) {
93 TestWinMultiprocessChildFails multiprocess_failing_child(
94 FailureType::kAssert);
95 multiprocess_failing_child.SetExpectedChildExitCode(255);
96 multiprocess_failing_child.Run();
97 }
98
55 } // namespace 99 } // namespace
56 } // namespace test 100 } // namespace test
57 } // namespace crashpad 101 } // namespace crashpad
OLDNEW
« no previous file with comments | « test/win/win_multiprocess.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698