| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "remoting/base/constants.h" | 8 #include "remoting/base/constants.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 XServerClipboard clipboard_; | 60 XServerClipboard clipboard_; |
| 61 Display* display_; | 61 Display* display_; |
| 62 | 62 |
| 63 DISALLOW_COPY_AND_ASSIGN(ClipboardTestClient); | 63 DISALLOW_COPY_AND_ASSIGN(ClipboardTestClient); |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 } // namespace | 66 } // namespace |
| 67 | 67 |
| 68 class XServerClipboardTest : public testing::Test { | 68 class XServerClipboardTest : public testing::Test { |
| 69 public: | 69 public: |
| 70 virtual void SetUp() override { | 70 void SetUp() override { |
| 71 // XSynchronize() ensures that PumpXEvents() fully processes all X server | 71 // XSynchronize() ensures that PumpXEvents() fully processes all X server |
| 72 // requests and responses before returning to the caller. | 72 // requests and responses before returning to the caller. |
| 73 Display* display1 = XOpenDisplay(NULL); | 73 Display* display1 = XOpenDisplay(NULL); |
| 74 XSynchronize(display1, True); | 74 XSynchronize(display1, True); |
| 75 client1_.Init(display1); | 75 client1_.Init(display1); |
| 76 Display* display2 = XOpenDisplay(NULL); | 76 Display* display2 = XOpenDisplay(NULL); |
| 77 XSynchronize(display2, True); | 77 XSynchronize(display2, True); |
| 78 client2_.Init(display2); | 78 client2_.Init(display2); |
| 79 } | 79 } |
| 80 | 80 |
| 81 virtual void TearDown() override { | 81 void TearDown() override { |
| 82 XCloseDisplay(client1_.display()); | 82 XCloseDisplay(client1_.display()); |
| 83 XCloseDisplay(client2_.display()); | 83 XCloseDisplay(client2_.display()); |
| 84 } | 84 } |
| 85 | 85 |
| 86 void PumpXEvents() { | 86 void PumpXEvents() { |
| 87 while (true) { | 87 while (true) { |
| 88 if (!client1_.PumpXEvents() && !client2_.PumpXEvents()) { | 88 if (!client1_.PumpXEvents() && !client2_.PumpXEvents()) { |
| 89 break; | 89 break; |
| 90 } | 90 } |
| 91 } | 91 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 111 client2_.SetClipboardData("Text3"); | 111 client2_.SetClipboardData("Text3"); |
| 112 PumpXEvents(); | 112 PumpXEvents(); |
| 113 EXPECT_EQ("Text3", client1_.clipboard_data()); | 113 EXPECT_EQ("Text3", client1_.clipboard_data()); |
| 114 | 114 |
| 115 client2_.SetClipboardData("Text4"); | 115 client2_.SetClipboardData("Text4"); |
| 116 PumpXEvents(); | 116 PumpXEvents(); |
| 117 EXPECT_EQ("Text4", client1_.clipboard_data()); | 117 EXPECT_EQ("Text4", client1_.clipboard_data()); |
| 118 } | 118 } |
| 119 | 119 |
| 120 } // namespace remoting | 120 } // namespace remoting |
| OLD | NEW |