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

Unified Diff: chrome/test/remoting/remote_desktop_browsertest.h

Issue 807343002: Adding the first set of remote test cases and associated framework. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing comments and merge issues. Created 5 years, 11 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: chrome/test/remoting/remote_desktop_browsertest.h
diff --git a/chrome/test/remoting/remote_desktop_browsertest.h b/chrome/test/remoting/remote_desktop_browsertest.h
index 7ec09817c82b90a1f644b3595142b52d4d2cb76a..2d71024f1aabed2bb996ea3ebd43e16d878f3e6b 100644
--- a/chrome/test/remoting/remote_desktop_browsertest.h
+++ b/chrome/test/remoting/remote_desktop_browsertest.h
@@ -10,6 +10,7 @@
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/test/base/ui_test_utils.h"
+#include "chrome/test/remoting/remote_test_helper.h"
#include "content/public/browser/notification_service.h"
#include "content/public/test/browser_test_utils.h"
#include "net/dns/mock_host_resolver.h"
@@ -30,20 +31,6 @@ const char kRemoteHostName[] = "remote-host-name";
const char kExtensionName[] = "extension-name";
const char kHttpServer[] = "http-server";
-// ASSERT_TRUE can only be used in void returning functions. This version
-// should be used in non-void-returning functions.
-inline void _ASSERT_TRUE(bool condition) {
- if (!condition) {
- // ASSERT_TRUE only prints the first call frame in the error message.
- // In our case, this is the _ASSERT_TRUE wrapper function, which is not
- // useful. To help with debugging, we will dump the full callstack.
- LOG(ERROR) << "Assertion failed.";
- LOG(ERROR) << base::debug::StackTrace().ToString();
- }
- ASSERT_TRUE(condition);
- return;
-}
-
} // namespace
using extensions::Extension;
@@ -221,6 +208,10 @@ class RemoteDesktopBrowserTest : public extensions::PlatformAppBrowserTest {
return app_web_content_;
}
+ RemoteTestHelper* remote_test_helper() const {
+ return remote_test_helper_.get();
+ }
+
// Whether to perform the cleanup tasks (uninstalling chromoting, etc).
// This is useful for diagnostic purposes.
bool NoCleanup() { return no_cleanup_; }
@@ -255,33 +246,24 @@ class RemoteDesktopBrowserTest : public extensions::PlatformAppBrowserTest {
// Helper to execute a JavaScript code snippet in the active WebContents
// and extract the boolean result.
bool ExecuteScriptAndExtractBool(const std::string& script) {
- return ExecuteScriptAndExtractBool(active_web_contents(), script);
+ return RemoteTestHelper::ExecuteScriptAndExtractBool(
+ active_web_contents(), script);
}
- // Helper to execute a JavaScript code snippet and extract the boolean result.
- static bool ExecuteScriptAndExtractBool(content::WebContents* web_contents,
- const std::string& script);
-
// Helper to execute a JavaScript code snippet in the active WebContents
// and extract the int result.
int ExecuteScriptAndExtractInt(const std::string& script) {
- return ExecuteScriptAndExtractInt(active_web_contents(), script);
+ return RemoteTestHelper::ExecuteScriptAndExtractInt(
+ active_web_contents(), script);
}
- // Helper to execute a JavaScript code snippet and extract the int result.
- static int ExecuteScriptAndExtractInt(content::WebContents* web_contents,
- const std::string& script);
-
// Helper to execute a JavaScript code snippet in the active WebContents
// and extract the string result.
std::string ExecuteScriptAndExtractString(const std::string& script) {
- return ExecuteScriptAndExtractString(active_web_contents(), script);
+ return RemoteTestHelper::ExecuteScriptAndExtractString(
+ active_web_contents(), script);
}
- // Helper to execute a JavaScript code snippet and extract the string result.
- static std::string ExecuteScriptAndExtractString(
- content::WebContents* web_contents, const std::string& script);
-
// Helper to load a JavaScript file from |path| and inject it to
// current web_content. The variable |path| is relative to the directory of
// the |browsertest| executable.
@@ -375,6 +357,9 @@ class RemoteDesktopBrowserTest : public extensions::PlatformAppBrowserTest {
// will get acknowledgments of actions completed on the host.
content::WebContents* client_web_content_;
+ // Helper class to assist in performing and verifying remote operations.
+ scoped_ptr<RemoteTestHelper> remote_test_helper_;
+
// WebContent of the landing page in the chromoting app.
content::WebContents* app_web_content_;

Powered by Google App Engine
This is Rietveld 408576698