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

Unified Diff: util/mach/exc_server_variants_test.cc

Issue 781823002: Add CompositeMachMessageServer and its test (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 6 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « util/mach/exc_server_variants.cc ('k') | util/mach/mach_message_server.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: util/mach/exc_server_variants_test.cc
diff --git a/util/mach/exc_server_variants_test.cc b/util/mach/exc_server_variants_test.cc
index 84a65e2182c24a6754bb8183c0af200cc8a1e7de..e47d9f929ae9e262d1635256e4c8d9733fd6a9a6 100644
--- a/util/mach/exc_server_variants_test.cc
+++ b/util/mach/exc_server_variants_test.cc
@@ -584,6 +584,10 @@ TEST(ExcServerVariants, MockExceptionRaise) {
MockUniversalMachExcServer server;
UniversalMachExcServer universal_mach_exc_server(&server);
+ std::set<mach_msg_id_t> ids =
+ universal_mach_exc_server.MachMessageServerRequestIDs();
+ EXPECT_NE(ids.end(), ids.find(2401)); // There is no constant for this.
+
ExceptionRaiseRequest request;
EXPECT_LE(request.Head.msgh_size,
universal_mach_exc_server.MachMessageServerRequestSize());
@@ -625,6 +629,10 @@ TEST(ExcServerVariants, MockExceptionRaiseState) {
MockUniversalMachExcServer server;
UniversalMachExcServer universal_mach_exc_server(&server);
+ std::set<mach_msg_id_t> ids =
+ universal_mach_exc_server.MachMessageServerRequestIDs();
+ EXPECT_NE(ids.end(), ids.find(2402)); // There is no constant for this.
+
ExceptionRaiseStateRequest request;
EXPECT_LE(request.Head.msgh_size,
universal_mach_exc_server.MachMessageServerRequestSize());
@@ -670,6 +678,10 @@ TEST(ExcServerVariants, MockExceptionRaiseStateIdentity) {
MockUniversalMachExcServer server;
UniversalMachExcServer universal_mach_exc_server(&server);
+ std::set<mach_msg_id_t> ids =
+ universal_mach_exc_server.MachMessageServerRequestIDs();
+ EXPECT_NE(ids.end(), ids.find(2403)); // There is no constant for this.
+
ExceptionRaiseStateIdentityRequest request;
EXPECT_LE(request.Head.msgh_size,
universal_mach_exc_server.MachMessageServerRequestSize());
@@ -712,6 +724,10 @@ TEST(ExcServerVariants, MockMachExceptionRaise) {
MockUniversalMachExcServer server;
UniversalMachExcServer universal_mach_exc_server(&server);
+ std::set<mach_msg_id_t> ids =
+ universal_mach_exc_server.MachMessageServerRequestIDs();
+ EXPECT_NE(ids.end(), ids.find(2405)); // There is no constant for this.
+
MachExceptionRaiseRequest request;
EXPECT_LE(request.Head.msgh_size,
universal_mach_exc_server.MachMessageServerRequestSize());
@@ -755,6 +771,10 @@ TEST(ExcServerVariants, MockMachExceptionRaiseState) {
MockUniversalMachExcServer server;
UniversalMachExcServer universal_mach_exc_server(&server);
+ std::set<mach_msg_id_t> ids =
+ universal_mach_exc_server.MachMessageServerRequestIDs();
+ EXPECT_NE(ids.end(), ids.find(2406)); // There is no constant for this.
+
MachExceptionRaiseStateRequest request;
EXPECT_LE(request.Head.msgh_size,
universal_mach_exc_server.MachMessageServerRequestSize());
@@ -801,6 +821,10 @@ TEST(ExcServerVariants, MockMachExceptionRaiseStateIdentity) {
MockUniversalMachExcServer server;
UniversalMachExcServer universal_mach_exc_server(&server);
+ std::set<mach_msg_id_t> ids =
+ universal_mach_exc_server.MachMessageServerRequestIDs();
+ EXPECT_NE(ids.end(), ids.find(2407)); // There is no constant for this.
+
MachExceptionRaiseStateIdentityRequest request;
EXPECT_LE(request.Head.msgh_size,
universal_mach_exc_server.MachMessageServerRequestSize());
@@ -882,6 +906,10 @@ TEST(ExcServerVariants, MockUnknownID) {
SCOPED_TRACE(base::StringPrintf("unknown id %d", id));
+ std::set<mach_msg_id_t> ids =
+ universal_mach_exc_server.MachMessageServerRequestIDs();
+ EXPECT_EQ(ids.end(), ids.find(id));
+
InvalidRequest request(id);
EXPECT_LE(sizeof(request),
universal_mach_exc_server.MachMessageServerRequestSize());
@@ -906,6 +934,24 @@ TEST(ExcServerVariants, MockUnknownID) {
}
}
+TEST(ExcServerVariants, MachMessageServerRequestIDs) {
+ std::set<mach_msg_id_t> expect_request_ids;
+
+ // There are no constants for these.
+ expect_request_ids.insert(2401);
+ expect_request_ids.insert(2402);
+ expect_request_ids.insert(2403);
+ expect_request_ids.insert(2405);
+ expect_request_ids.insert(2406);
+ expect_request_ids.insert(2407);
+
+ MockUniversalMachExcServer server;
+ UniversalMachExcServer universal_mach_exc_server(&server);
+
+ EXPECT_EQ(expect_request_ids,
+ universal_mach_exc_server.MachMessageServerRequestIDs());
+}
+
class TestExcServerVariants : public MachMultiprocess,
public UniversalMachExcServer::Interface {
public:
« no previous file with comments | « util/mach/exc_server_variants.cc ('k') | util/mach/mach_message_server.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698