This source file includes following definitions.
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- TestKeyboardInput
- TestMouseInput
- ConnectPinlessAndCleanupPairings
- IsPairingSpinnerHidden
#include "base/file_util.h"
#include "base/files/file_path.h"
#include "chrome/test/remoting/remote_desktop_browsertest.h"
#include "chrome/test/remoting/waiter.h"
namespace remoting {
class Me2MeBrowserTest : public RemoteDesktopBrowserTest {
protected:
void TestKeyboardInput();
void TestMouseInput();
void ConnectPinlessAndCleanupPairings(bool cleanup_all);
bool IsPairingSpinnerHidden();
};
IN_PROC_BROWSER_TEST_F(Me2MeBrowserTest,
MANUAL_Me2Me_Connect_Local_Host) {
VerifyInternetAccess();
Install();
LaunchChromotingApp();
Auth();
ExpandMe2Me();
ConnectToLocalHost(false);
OpenClientBrowserPage();
TestKeyboardInput();
DisconnectMe2Me();
Cleanup();
}
IN_PROC_BROWSER_TEST_F(Me2MeBrowserTest,
MANUAL_Me2Me_Connect_Remote_Host) {
VerifyInternetAccess();
Install();
LaunchChromotingApp();
Auth();
ExpandMe2Me();
ConnectToRemoteHost(remote_host_name(), false);
DisconnectMe2Me();
Cleanup();
}
IN_PROC_BROWSER_TEST_F(Me2MeBrowserTest,
MANUAL_Me2Me_Connect_Pinless) {
VerifyInternetAccess();
Install();
LaunchChromotingApp();
Auth();
ExpandMe2Me();
ASSERT_FALSE(HtmlElementVisible("paired-client-manager-message"))
<< "The host must have no pairings before running the pinless test.";
ConnectPinlessAndCleanupPairings(false);
ConnectPinlessAndCleanupPairings(true);
Cleanup();
}
void Me2MeBrowserTest::TestKeyboardInput() {
SimulateKeyPressWithCode(ui::VKEY_TAB, "Tab", false, false, false, false);
std::string text = "Abigail";
SimulateStringInput(text);
SimulateKeyPressWithCode(
ui::VKEY_RETURN, "Enter", false, false, false, false);
ConditionalTimeoutWaiter waiter(
base::TimeDelta::FromSeconds(10),
base::TimeDelta::FromMilliseconds(500),
base::Bind(&RemoteDesktopBrowserTest::IsHostActionComplete,
client_web_content(),
"testResult.keypressSucceeded"));
EXPECT_TRUE(waiter.Wait());
EXPECT_TRUE(ExecuteScriptAndExtractBool(
client_web_content(),
"testResult.keypressText == '" + text + "'"));
}
void Me2MeBrowserTest::TestMouseInput() {
SimulateMouseLeftClickAt(10, 50);
ASSERT_TRUE(TimeoutWaiter(base::TimeDelta::FromSeconds(5)).Wait());
}
void Me2MeBrowserTest::ConnectPinlessAndCleanupPairings(bool cleanup_all) {
ConnectToLocalHost(true);
DisconnectMe2Me();
LaunchChromotingApp();
ASSERT_TRUE(HtmlElementVisible("paired-client-manager-message"));
ClickOnControl("this-host-connect");
WaitForConnection();
DisconnectMe2Me();
ClickOnControl("open-paired-client-manager-dialog");
ASSERT_TRUE(HtmlElementVisible("paired-client-manager-dialog"));
if (cleanup_all) {
ClickOnControl("delete-all-paired-clients");
} else {
std::string host_id = ExecuteScriptAndExtractString(
"remoting.pairedClientManager.getFirstClientIdForTesting_()");
std::string node_id = "delete-client-" + host_id;
ClickOnControl(node_id);
}
ConditionalTimeoutWaiter waiter(
base::TimeDelta::FromSeconds(5),
base::TimeDelta::FromMilliseconds(200),
base::Bind(&Me2MeBrowserTest::IsPairingSpinnerHidden, this));
EXPECT_TRUE(waiter.Wait());
EXPECT_TRUE(ExecuteScriptAndExtractBool(
"document.getElementById('delete-all-paired-clients').disabled"));
ClickOnControl("close-paired-client-manager-dialog");
ASSERT_FALSE(HtmlElementVisible("paired-client-manager-dialog"));
ASSERT_FALSE(HtmlElementVisible("paired-client-manager-message"));
}
bool Me2MeBrowserTest::IsPairingSpinnerHidden() {
return !HtmlElementVisible("paired-client-manager-dialog-working");
}
}