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