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 // Unit test for SyncChannel. | 5 // Unit test for SyncChannel. |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 // sync call on another channel. | 721 // sync call on another channel. |
722 // The callstack should unwind correctly, i.e. the outermost call should | 722 // The callstack should unwind correctly, i.e. the outermost call should |
723 // complete first, and so on. | 723 // complete first, and so on. |
724 class QueuedReplyClient : public Worker { | 724 class QueuedReplyClient : public Worker { |
725 public: | 725 public: |
726 QueuedReplyClient(base::Thread* listener_thread, | 726 QueuedReplyClient(base::Thread* listener_thread, |
727 const std::string& channel_name, | 727 const std::string& channel_name, |
728 const std::string& expected_text, | 728 const std::string& expected_text, |
729 bool pump_during_send) | 729 bool pump_during_send) |
730 : Worker(channel_name, Channel::MODE_CLIENT), | 730 : Worker(channel_name, Channel::MODE_CLIENT), |
731 expected_text_(expected_text), | 731 pump_during_send_(pump_during_send), |
732 pump_during_send_(pump_during_send) { | 732 expected_text_(expected_text) { |
733 Worker::OverrideThread(listener_thread); | 733 Worker::OverrideThread(listener_thread); |
734 } | 734 } |
735 | 735 |
736 virtual void Run() { | 736 virtual void Run() { |
737 std::string response; | 737 std::string response; |
738 SyncMessage* msg = new SyncChannelNestedTestMsg_String(&response); | 738 SyncMessage* msg = new SyncChannelNestedTestMsg_String(&response); |
739 if (pump_during_send_) | 739 if (pump_during_send_) |
740 msg->EnableMessagePumping(); | 740 msg->EnableMessagePumping(); |
741 bool result = Send(msg); | 741 bool result = Send(msg); |
742 DCHECK(result); | 742 DCHECK(result); |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1109 | 1109 |
1110 } // namespace | 1110 } // namespace |
1111 | 1111 |
1112 // Tests basic synchronous call | 1112 // Tests basic synchronous call |
1113 TEST_F(IPCSyncChannelTest, SyncMessageFilter) { | 1113 TEST_F(IPCSyncChannelTest, SyncMessageFilter) { |
1114 std::vector<Worker*> workers; | 1114 std::vector<Worker*> workers; |
1115 workers.push_back(new SyncMessageFilterServer()); | 1115 workers.push_back(new SyncMessageFilterServer()); |
1116 workers.push_back(new SimpleClient()); | 1116 workers.push_back(new SimpleClient()); |
1117 RunTest(workers); | 1117 RunTest(workers); |
1118 } | 1118 } |
OLD | NEW |