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 "base/at_exit.h" | 5 #include "base/at_exit.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "mojo/common/common_type_converters.h" | 8 #include "mojo/common/common_type_converters.h" |
9 #include "mojo/services/public/interfaces/clipboard/clipboard.mojom.h" | 9 #include "mojo/services/public/interfaces/clipboard/clipboard.mojom.h" |
10 #include "mojo/shell/shell_test_helper.h" | 10 #include "mojo/shell/shell_test_helper.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 namespace service { | 45 namespace service { |
46 | 46 |
47 class ClipboardStandaloneTest : public testing::Test { | 47 class ClipboardStandaloneTest : public testing::Test { |
48 public: | 48 public: |
49 ClipboardStandaloneTest() {} | 49 ClipboardStandaloneTest() {} |
50 virtual ~ClipboardStandaloneTest() {} | 50 virtual ~ClipboardStandaloneTest() {} |
51 | 51 |
52 virtual void SetUp() override { | 52 virtual void SetUp() override { |
53 test_helper_.Init(); | 53 test_helper_.Init(); |
54 | 54 |
55 test_helper_.application_manager()->ConnectToService( | 55 test_helper_.application_manager()->ConnectToService(GURL("mojo:clipboard"), |
56 GURL("mojo:mojo_clipboard"), &clipboard_); | 56 &clipboard_); |
57 } | 57 } |
58 | 58 |
59 uint64_t GetSequenceNumber() { | 59 uint64_t GetSequenceNumber() { |
60 base::RunLoop run_loop; | 60 base::RunLoop run_loop; |
61 uint64_t sequence_num = 999999; | 61 uint64_t sequence_num = 999999; |
62 clipboard_->GetSequenceNumber( | 62 clipboard_->GetSequenceNumber( |
63 mojo::Clipboard::TYPE_COPY_PASTE, | 63 mojo::Clipboard::TYPE_COPY_PASTE, |
64 base::Bind(&CopyUint64AndEndRunloop, &sequence_num, &run_loop)); | 64 base::Bind(&CopyUint64AndEndRunloop, &sequence_num, &run_loop)); |
65 run_loop.Run(); | 65 run_loop.Run(); |
66 return sequence_num; | 66 return sequence_num; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 Map<String, Array<uint8_t>> mime_data; | 153 Map<String, Array<uint8_t>> mime_data; |
154 clipboard_->WriteClipboardData(mojo::Clipboard::TYPE_COPY_PASTE, | 154 clipboard_->WriteClipboardData(mojo::Clipboard::TYPE_COPY_PASTE, |
155 mime_data.Pass()); | 155 mime_data.Pass()); |
156 | 156 |
157 EXPECT_EQ(2ul, GetSequenceNumber()); | 157 EXPECT_EQ(2ul, GetSequenceNumber()); |
158 EXPECT_FALSE(GetDataOfType(mojo::Clipboard::MIME_TYPE_TEXT, &data)); | 158 EXPECT_FALSE(GetDataOfType(mojo::Clipboard::MIME_TYPE_TEXT, &data)); |
159 } | 159 } |
160 | 160 |
161 } // namespace service | 161 } // namespace service |
162 } // namespace mojo | 162 } // namespace mojo |
OLD | NEW |