OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "mojo/public/cpp/application/application_impl.h" | 5 #include "mojo/public/cpp/application/application_impl.h" |
6 #include "mojo/public/cpp/application/application_test_base.h" | 6 #include "mojo/public/cpp/application/application_test_base.h" |
7 #include "mojo/public/cpp/system/macros.h" | 7 #include "mojo/public/cpp/system/macros.h" |
8 #include "mojo/public/interfaces/bindings/tests/versioning_test_client.mojom.h" | 8 #include "mojo/public/interfaces/bindings/tests/versioning_test_client.mojom.h" |
9 | 9 |
10 namespace mojo { | 10 namespace mojo { |
(...skipping 80 matching lines...) Loading... |
91 database_->QueryEmployee(1, false, | 91 database_->QueryEmployee(1, false, |
92 [](EmployeePtr returned_employee, | 92 [](EmployeePtr returned_employee, |
93 Array<uint8_t> returned_finger_print) {}); | 93 Array<uint8_t> returned_finger_print) {}); |
94 database_.WaitForIncomingResponse(); | 94 database_.WaitForIncomingResponse(); |
95 EXPECT_TRUE(database_.encountered_error()); | 95 EXPECT_TRUE(database_.encountered_error()); |
96 } | 96 } |
97 | 97 |
98 TEST_F(VersioningApplicationTest, CallNonexistentMethod) { | 98 TEST_F(VersioningApplicationTest, CallNonexistentMethod) { |
99 EXPECT_EQ(0u, database_.version()); | 99 EXPECT_EQ(0u, database_.version()); |
100 | 100 |
101 Array<uint8_t> new_finger_print(128); | 101 auto new_finger_print = Array<uint8_t>::New(128); |
102 for (size_t i = 0; i < 128; ++i) | 102 for (size_t i = 0; i < 128; ++i) |
103 new_finger_print[i] = i + 13; | 103 new_finger_print[i] = i + 13; |
104 | 104 |
105 // Although the client side doesn't know whether the service side supports | 105 // Although the client side doesn't know whether the service side supports |
106 // version 1, calling a version 1 method succeeds as long as the service side | 106 // version 1, calling a version 1 method succeeds as long as the service side |
107 // supports version 1. | 107 // supports version 1. |
108 database_->AttachFingerPrint(1, new_finger_print.Clone(), | 108 database_->AttachFingerPrint(1, new_finger_print.Clone(), |
109 [](bool success) { EXPECT_TRUE(success); }); | 109 [](bool success) { EXPECT_TRUE(success); }); |
110 database_.WaitForIncomingResponse(); | 110 database_.WaitForIncomingResponse(); |
111 | 111 |
112 // Calling a version 2 method (which the service side doesn't support) closes | 112 // Calling a version 2 method (which the service side doesn't support) closes |
113 // the pipe. | 113 // the pipe. |
114 database_->ListEmployeeIds([](Array<uint64_t> ids) { EXPECT_TRUE(false); }); | 114 database_->ListEmployeeIds([](Array<uint64_t> ids) { EXPECT_TRUE(false); }); |
115 database_.WaitForIncomingResponse(); | 115 database_.WaitForIncomingResponse(); |
116 EXPECT_TRUE(database_.encountered_error()); | 116 EXPECT_TRUE(database_.encountered_error()); |
117 } | 117 } |
118 | 118 |
119 } // namespace versioning | 119 } // namespace versioning |
120 } // namespace examples | 120 } // namespace examples |
121 } // namespace mojo | 121 } // namespace mojo |
OLD | NEW |