| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 #include <utility> | 6 #include <utility> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| 11 #include "components/clipboard/public/interfaces/clipboard.mojom.h" | 11 #include "components/clipboard/public/interfaces/clipboard.mojom.h" |
| 12 #include "mojo/common/common_type_converters.h" | 12 #include "mojo/common/common_type_converters.h" |
| 13 #include "mojo/shell/public/cpp/application_impl.h" | |
| 14 #include "mojo/shell/public/cpp/application_test_base.h" | 13 #include "mojo/shell/public/cpp/application_test_base.h" |
| 14 #include "mojo/shell/public/cpp/shell.h" |
| 15 | 15 |
| 16 using mojo::Array; | 16 using mojo::Array; |
| 17 using mojo::Clipboard; | 17 using mojo::Clipboard; |
| 18 using mojo::Map; | 18 using mojo::Map; |
| 19 using mojo::String; | 19 using mojo::String; |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 void CopyUint64AndEndRunloop(uint64_t* output, | 23 void CopyUint64AndEndRunloop(uint64_t* output, |
| 24 base::RunLoop* run_loop, | 24 base::RunLoop* run_loop, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 51 | 51 |
| 52 namespace clipboard { | 52 namespace clipboard { |
| 53 | 53 |
| 54 class ClipboardAppTest : public mojo::test::ApplicationTestBase { | 54 class ClipboardAppTest : public mojo::test::ApplicationTestBase { |
| 55 public: | 55 public: |
| 56 ClipboardAppTest() : ApplicationTestBase() {} | 56 ClipboardAppTest() : ApplicationTestBase() {} |
| 57 ~ClipboardAppTest() override {} | 57 ~ClipboardAppTest() override {} |
| 58 | 58 |
| 59 void SetUp() override { | 59 void SetUp() override { |
| 60 mojo::test::ApplicationTestBase::SetUp(); | 60 mojo::test::ApplicationTestBase::SetUp(); |
| 61 application_impl()->ConnectToService("mojo:clipboard", &clipboard_); | 61 shell()->ConnectToService("mojo:clipboard", &clipboard_); |
| 62 } | 62 } |
| 63 | 63 |
| 64 uint64_t GetSequenceNumber() { | 64 uint64_t GetSequenceNumber() { |
| 65 base::RunLoop run_loop; | 65 base::RunLoop run_loop; |
| 66 uint64_t sequence_num = 999999; | 66 uint64_t sequence_num = 999999; |
| 67 clipboard_->GetSequenceNumber( | 67 clipboard_->GetSequenceNumber( |
| 68 Clipboard::Type::COPY_PASTE, | 68 Clipboard::Type::COPY_PASTE, |
| 69 base::Bind(&CopyUint64AndEndRunloop, &sequence_num, &run_loop)); | 69 base::Bind(&CopyUint64AndEndRunloop, &sequence_num, &run_loop)); |
| 70 run_loop.Run(); | 70 run_loop.Run(); |
| 71 return sequence_num; | 71 return sequence_num; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 153 |
| 154 Map<String, Array<uint8_t>> mime_data; | 154 Map<String, Array<uint8_t>> mime_data; |
| 155 clipboard_->WriteClipboardData(Clipboard::Type::COPY_PASTE, | 155 clipboard_->WriteClipboardData(Clipboard::Type::COPY_PASTE, |
| 156 std::move(mime_data)); | 156 std::move(mime_data)); |
| 157 | 157 |
| 158 EXPECT_EQ(2ul, GetSequenceNumber()); | 158 EXPECT_EQ(2ul, GetSequenceNumber()); |
| 159 EXPECT_FALSE(GetDataOfType(Clipboard::MIME_TYPE_TEXT, &data)); | 159 EXPECT_FALSE(GetDataOfType(Clipboard::MIME_TYPE_TEXT, &data)); |
| 160 } | 160 } |
| 161 | 161 |
| 162 } // namespace clipboard | 162 } // namespace clipboard |
| OLD | NEW |