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

Unified Diff: chrome/test/webdriver/session.cc

Issue 7612017: Integrates SET_ONLINE and APPCACHE_STATUS atoms. Other commands for BrowserConnection (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 9 years, 4 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/webdriver/session.cc
===================================================================
--- chrome/test/webdriver/session.cc (revision 96198)
+++ chrome/test/webdriver/session.cc (working copy)
@@ -1480,4 +1480,40 @@
return NULL;
}
+Error* Session::GetBrowserConnectionState(bool* online) {
+ std::string jscript = base::StringPrintf(
+ "return (%s).apply(null, arguments);", atoms::IS_ONLINE);
+ base::ListValue no_args;
+ Value* unscoped_value = NULL;
+ Error* error = ExecuteScript(jscript,
+ &no_args,
+ &unscoped_value);
+ scoped_ptr<base::Value> value(unscoped_value);
+ if (error)
+ return error;
+ if (!value->GetAsBoolean(online))
+ return new Error(kUnknownError,
+ "IS_ONLINE script returned non-boolean: " +
+ JsonStringify(value.get()));
+ return NULL;
+}
+
+Error* Session::GetAppCacheStatus(int* status) {
+ std::string jscript = base::StringPrintf(
+ "return (%s).apply(null, arguments);", atoms::GET_APPCACHE_STATUS);
+ base::ListValue no_args;
+ Value* unscoped_value = NULL;
+ Error* error = ExecuteScript(jscript,
+ &no_args,
+ &unscoped_value);
+ scoped_ptr<base::Value> value(unscoped_value);
+ if (error)
+ return error;
+ if (!value->GetAsInteger(status))
+ return new Error(kUnknownError,
+ "GET_APPCACHE_STATUS script returned non-integer: " +
+ JsonStringify(value.get()));
+ return NULL;
+}
+
} // namespace webdriver

Powered by Google App Engine
This is Rietveld 408576698