OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ppapi/tests/test_flash_clipboard.h" | 5 #include "ppapi/tests/test_flash_clipboard.h" |
6 | 6 |
7 #include "ppapi/cpp/instance.h" | 7 #include "ppapi/cpp/instance.h" |
8 #include "ppapi/cpp/module.h" | 8 #include "ppapi/cpp/module.h" |
9 #include "ppapi/cpp/point.h" | 9 #include "ppapi/cpp/point.h" |
10 #include "ppapi/tests/testing_instance.h" | 10 #include "ppapi/tests/testing_instance.h" |
11 | 11 |
12 REGISTER_TEST_CASE(FlashClipboard); | 12 REGISTER_TEST_CASE(FlashClipboard); |
13 | 13 |
14 TestFlashClipboard::TestFlashClipboard(TestingInstance* instance) | 14 TestFlashClipboard::TestFlashClipboard(TestingInstance* instance) |
15 : TestCase(instance), | 15 : TestCase(instance), |
16 clipboard_interface_(NULL) { | 16 clipboard_interface_(NULL) { |
17 } | 17 } |
18 | 18 |
19 bool TestFlashClipboard::Init() { | 19 bool TestFlashClipboard::Init() { |
20 clipboard_interface_ = static_cast<const PPB_Flash_Clipboard*>( | 20 clipboard_interface_ = static_cast<const PPB_Flash_Clipboard*>( |
21 pp::Module::Get()->GetBrowserInterface(PPB_FLASH_CLIPBOARD_INTERFACE)); | 21 pp::Module::Get()->GetBrowserInterface(PPB_FLASH_CLIPBOARD_INTERFACE)); |
22 return !!clipboard_interface_; | 22 return !!clipboard_interface_; |
23 } | 23 } |
24 | 24 |
25 void TestFlashClipboard::RunTest() { | 25 void TestFlashClipboard::RunTests(const std::string& filter) { |
26 RUN_TEST(ReadWrite); | 26 RUN_TEST(ReadWrite, filter); |
27 } | 27 } |
28 | 28 |
29 std::string TestFlashClipboard::TestReadWrite() { | 29 std::string TestFlashClipboard::TestReadWrite() { |
30 std::string input_str("Hello, world"); | 30 std::string input_str("Hello, world"); |
31 pp::Var input_var(input_str); | 31 pp::Var input_var(input_str); |
32 clipboard_interface_->WritePlainText(instance_->pp_instance(), | 32 clipboard_interface_->WritePlainText(instance_->pp_instance(), |
33 PP_FLASH_CLIPBOARD_TYPE_STANDARD, | 33 PP_FLASH_CLIPBOARD_TYPE_STANDARD, |
34 input_var.pp_var()); | 34 input_var.pp_var()); |
35 | 35 |
36 // WritePlainText() causes an async request sent to the browser process. | 36 // WritePlainText() causes an async request sent to the browser process. |
(...skipping 24 matching lines...) Expand all Loading... |
61 result_str = result_var.AsString(); | 61 result_str = result_var.AsString(); |
62 if (result_str == input_str) | 62 if (result_str == input_str) |
63 break; | 63 break; |
64 | 64 |
65 PlatformSleep(kIntervalMs); | 65 PlatformSleep(kIntervalMs); |
66 } | 66 } |
67 | 67 |
68 ASSERT_TRUE(result_str == input_str); | 68 ASSERT_TRUE(result_str == input_str); |
69 PASS(); | 69 PASS(); |
70 } | 70 } |
OLD | NEW |