OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stdio.h> | 5 #include <stdio.h> |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 RunValidationTests("resp_boundscheck_", validators.GetHead()); | 401 RunValidationTests("resp_boundscheck_", validators.GetHead()); |
402 } | 402 } |
403 | 403 |
404 // Test that InterfacePtr<X> applies the correct validators and they don't | 404 // Test that InterfacePtr<X> applies the correct validators and they don't |
405 // conflict with each other: | 405 // conflict with each other: |
406 // - MessageHeaderValidator | 406 // - MessageHeaderValidator |
407 // - X::ResponseValidator_ | 407 // - X::ResponseValidator_ |
408 TEST_F(ValidationIntegrationTest, InterfacePtr) { | 408 TEST_F(ValidationIntegrationTest, InterfacePtr) { |
409 IntegrationTestInterfacePtr interface_ptr = MakeProxy( | 409 IntegrationTestInterfacePtr interface_ptr = MakeProxy( |
410 InterfacePtrInfo<IntegrationTestInterface>(testee_endpoint().Pass(), 0u)); | 410 InterfacePtrInfo<IntegrationTestInterface>(testee_endpoint().Pass(), 0u)); |
411 interface_ptr.internal_state()->router_for_testing()->EnableTestingMode(); | 411 interface_ptr.internal_state()->EnableTestingMode(); |
412 | 412 |
413 RunValidationTests("integration_intf_resp", test_message_receiver()); | 413 RunValidationTests("integration_intf_resp", test_message_receiver()); |
414 RunValidationTests("integration_msghdr", test_message_receiver()); | 414 RunValidationTests("integration_msghdr", test_message_receiver()); |
415 } | 415 } |
416 | 416 |
417 // Test that Binding<X> applies the correct validators and they don't | 417 // Test that Binding<X> applies the correct validators and they don't |
418 // conflict with each other: | 418 // conflict with each other: |
419 // - MessageHeaderValidator | 419 // - MessageHeaderValidator |
420 // - X::RequestValidator_ | 420 // - X::RequestValidator_ |
421 TEST_F(ValidationIntegrationTest, Binding) { | 421 TEST_F(ValidationIntegrationTest, Binding) { |
422 IntegrationTestInterfaceImpl interface_impl; | 422 IntegrationTestInterfaceImpl interface_impl; |
423 Binding<IntegrationTestInterface> binding( | 423 Binding<IntegrationTestInterface> binding( |
424 &interface_impl, | 424 &interface_impl, |
425 MakeRequest<IntegrationTestInterface>(testee_endpoint().Pass())); | 425 MakeRequest<IntegrationTestInterface>(testee_endpoint().Pass())); |
426 binding.internal_router()->EnableTestingMode(); | 426 binding.EnableTestingMode(); |
427 | 427 |
428 RunValidationTests("integration_intf_rqst", test_message_receiver()); | 428 RunValidationTests("integration_intf_rqst", test_message_receiver()); |
429 RunValidationTests("integration_msghdr", test_message_receiver()); | 429 RunValidationTests("integration_msghdr", test_message_receiver()); |
430 } | 430 } |
431 | 431 |
432 // Test pointer validation (specifically, that the encoded offset is 32-bit) | 432 // Test pointer validation (specifically, that the encoded offset is 32-bit) |
433 TEST_F(ValidationTest, ValidateEncodedPointer) { | 433 TEST_F(ValidationTest, ValidateEncodedPointer) { |
434 uint64_t offset; | 434 uint64_t offset; |
435 | 435 |
436 offset = 0ULL; | 436 offset = 0ULL; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 static_cast<StructWithEnum::EnumWithin>(2))); | 473 static_cast<StructWithEnum::EnumWithin>(2))); |
474 EXPECT_TRUE(StructWithEnum::EnumWithin_IsValidValue( | 474 EXPECT_TRUE(StructWithEnum::EnumWithin_IsValidValue( |
475 static_cast<StructWithEnum::EnumWithin>(3))); | 475 static_cast<StructWithEnum::EnumWithin>(3))); |
476 EXPECT_FALSE(StructWithEnum::EnumWithin_IsValidValue( | 476 EXPECT_FALSE(StructWithEnum::EnumWithin_IsValidValue( |
477 static_cast<StructWithEnum::EnumWithin>(4))); | 477 static_cast<StructWithEnum::EnumWithin>(4))); |
478 } | 478 } |
479 | 479 |
480 } // namespace | 480 } // namespace |
481 } // namespace test | 481 } // namespace test |
482 } // namespace mojo | 482 } // namespace mojo |
OLD | NEW |