Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2106)

Unified Diff: remoting/test/app_remoting_latency_test_fixture.cc

Issue 1253613002: Updated latency fixture and refactored connection helper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: "Updated naming for accessor of test_chromoting_client_" Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: remoting/test/app_remoting_latency_test_fixture.cc
diff --git a/remoting/test/app_remoting_latency_test_fixture.cc b/remoting/test/app_remoting_latency_test_fixture.cc
index 95b8e07d43162c30a30c87ac3767e7cbfe23cd7a..b1d257b4884cb3bf2d0632f7c98232754ae813d5 100644
--- a/remoting/test/app_remoting_latency_test_fixture.cc
+++ b/remoting/test/app_remoting_latency_test_fixture.cc
@@ -13,6 +13,7 @@
#include "remoting/protocol/usb_key_codes.h"
#include "remoting/test/app_remoting_connection_helper.h"
#include "remoting/test/app_remoting_test_driver_environment.h"
+#include "remoting/test/rgb_value.h"
#include "remoting/test/test_chromoting_client.h"
#include "remoting/test/test_video_renderer.h"
@@ -36,6 +37,8 @@ void AppRemotingLatencyTestFixture::SetUp() {
scoped_ptr<TestChromotingClient> test_chromoting_client(
new TestChromotingClient(test_video_renderer.Pass()));
+ test_chromoting_client->AddRemoteConnectionObserver(this);
+
connection_helper_.reset(
new AppRemotingConnectionHelper(GetApplicationDetails()));
connection_helper_->Initialize(test_chromoting_client.Pass());
@@ -44,6 +47,11 @@ void AppRemotingLatencyTestFixture::SetUp() {
LOG(ERROR) << "Remote host connection could not be established.";
FAIL();
}
+
+ if (!PrepareApplicationForTesting()) {
+ LOG(ERROR) << "Unable to prepare application for testing.";
+ FAIL();
+ }
}
void AppRemotingLatencyTestFixture::TearDown() {
@@ -52,13 +60,15 @@ void AppRemotingLatencyTestFixture::TearDown() {
ResetApplicationState();
}
+ connection_helper_->test_chromoting_client()->RemoveRemoteConnectionObserver(
+ this);
connection_helper_.reset();
}
WaitForImagePatternMatchCallback
AppRemotingLatencyTestFixture::SetExpectedImagePattern(
const webrtc::DesktopRect& expected_rect,
- uint32_t expected_color) {
+ const RGBValue& expected_color) {
DCHECK(thread_checker_.CalledOnValidThread());
scoped_ptr<base::RunLoop> run_loop(new base::RunLoop());
@@ -91,6 +101,15 @@ bool AppRemotingLatencyTestFixture::WaitForImagePatternMatch(
return image_pattern_is_matched;
}
+void AppRemotingLatencyTestFixture::HostMessageReceived(
+ const protocol::ExtensionMessage& message) {
+ DCHECK(thread_checker_.CalledOnValidThread());
+
+ if (!host_message_received_callback_.is_null()) {
+ host_message_received_callback_.Run(message);
+ }
+}
+
void AppRemotingLatencyTestFixture::PressKey(uint32_t usb_keycode,
bool pressed) {
remoting::protocol::KeyEvent event;
@@ -117,6 +136,10 @@ void AppRemotingLatencyTestFixture::PressAndReleaseKeyCombination(
}
}
+void AppRemotingLatencyTestFixture::ResetHostMessageReceivedCallback() {
+ host_message_received_callback_.Reset();
+}
+
void AppRemotingLatencyTestFixture::ResetApplicationState() {
DCHECK(!timer_->IsRunning());
DCHECK(!run_loop_ || !run_loop_->running());

Powered by Google App Engine
This is Rietveld 408576698