diff options
author | weitaosu@chromium.org <weitaosu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-30 21:17:09 +0000 |
---|---|---|
committer | weitaosu@chromium.org <weitaosu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-30 21:17:09 +0000 |
commit | 8d4fbebdae0e1b4f2f112940efd6cee20c828217 (patch) | |
tree | adb7538039e6bf8565db835e882f96f88ecdd423 /remoting | |
parent | b904d1299ee49388bed0fe71a7bd75ce9badecaa (diff) | |
download | chromium_src-8d4fbebdae0e1b4f2f112940efd6cee20c828217.zip chromium_src-8d4fbebdae0e1b4f2f112940efd6cee20c828217.tar.gz chromium_src-8d4fbebdae0e1b4f2f112940efd6cee20c828217.tar.bz2 |
Complete the Me2Me_Connect_LocalHost end-to-end test: verify keyboard input programatically.
BUG=134210
Review URL: https://codereview.chromium.org/24968002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@226045 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r-- | remoting/test/key_code_map.h | 2 | ||||
-rw-r--r-- | remoting/test/me2me_browsertest.cc | 34 | ||||
-rw-r--r-- | remoting/test/remote_desktop_browsertest.cc | 2 |
3 files changed, 31 insertions, 7 deletions
diff --git a/remoting/test/key_code_map.h b/remoting/test/key_code_map.h index 32f5c81..81d76d9 100644 --- a/remoting/test/key_code_map.h +++ b/remoting/test/key_code_map.h @@ -3,7 +3,7 @@ // found in the LICENSE file. // Source of data in this file: -// 1. ui/base/keycodes/usb_keycode_map.h +// 1. ui/base/keycodes/keycode_converter_data.h // 2. ui/events/keycodes/keyboard_codes.h // 3. third_party/WebKit/Source/core/platform/chromium/KeyboardCodes.h #ifndef REMOTING_TEST_KEY_CODE_MAP_H_ diff --git a/remoting/test/me2me_browsertest.cc b/remoting/test/me2me_browsertest.cc index 7b40611..0b68d67 100644 --- a/remoting/test/me2me_browsertest.cc +++ b/remoting/test/me2me_browsertest.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/file_util.h" +#include "base/files/file_path.h" #include "remoting/test/remote_desktop_browsertest.h" #include "remoting/test/waiter.h" @@ -30,20 +32,42 @@ IN_PROC_BROWSER_TEST_F(Me2MeBrowserTest, TestKeyboardInput(); + TestMouseInput(); + Cleanup(); } +// Typing a command which writes to a temp file and then verify the contents of +// the file. void Me2MeBrowserTest::TestKeyboardInput() { // Start a terminal windows with ctrl+alt+T SimulateKeyPressWithCode(ui::VKEY_T, "KeyT", true, false, true, false); - ASSERT_TRUE(TimeoutWaiter(base::TimeDelta::FromSeconds(1)).Wait()); - // Run an arbitrary command so that I can verify the result visually. - // TODO: Verify programatically the keyboard events are received by the host. - SimulateStringInput("ls -la\n"); - ASSERT_TRUE(TimeoutWaiter(base::TimeDelta::FromSeconds(1)).Wait()); + // Wait for the keyboard events to be sent to and processed by the host. + ASSERT_TRUE(TimeoutWaiter(base::TimeDelta::FromMilliseconds(300)).Wait()); + + base::FilePath temp_file; + EXPECT_TRUE(file_util::CreateTemporaryFile(&temp_file)); + + // Write some text into the temp file. + std::string text = "Abigail"; + std::string command = "echo -n " + text + " > " + + temp_file.MaybeAsASCII() + "\n"; + SimulateStringInput(command); SimulateStringInput("exit\n"); + + // Wait for the keyboard events to be sent to and processed by the host. ASSERT_TRUE(TimeoutWaiter(base::TimeDelta::FromSeconds(1)).Wait()); + + // Read the content of the temp file. + std::string content; + EXPECT_TRUE(base::ReadFileToString(temp_file, &content)); + + LOG(INFO) << temp_file.value(); + + EXPECT_EQ(text, content); + + EXPECT_TRUE(base::DeleteFile(temp_file, false)); } void Me2MeBrowserTest::TestMouseInput() { diff --git a/remoting/test/remote_desktop_browsertest.cc b/remoting/test/remote_desktop_browsertest.cc index e756d13..3c2b7b7 100644 --- a/remoting/test/remote_desktop_browsertest.cc +++ b/remoting/test/remote_desktop_browsertest.cc @@ -548,7 +548,7 @@ void RemoteDesktopBrowserTest::WaitForConnection() { // TODO(weitaosu): Instead of polling, can we register a callback to // remoting.clientSession.onStageChange_? ConditionalTimeoutWaiter waiter( - base::TimeDelta::FromSeconds(3), + base::TimeDelta::FromSeconds(4), base::TimeDelta::FromSeconds(1), base::Bind(&RemoteDesktopBrowserTest::IsSessionConnected, this)); EXPECT_TRUE(waiter.Wait()); |