summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Android.mk4
-rw-r--r--LayoutTests/platform/android/test_expectations.txt2
-rw-r--r--WebKit/android/WebCoreSupport/WebRequestContext.cpp30
-rw-r--r--WebKit/android/WebCoreSupport/WebRequestContext.h12
-rw-r--r--WebKit/android/jni/WebSettings.cpp9
5 files changed, 49 insertions, 8 deletions
diff --git a/Android.mk b/Android.mk
index ee8b3d8..5cd23b3 100644
--- a/Android.mk
+++ b/Android.mk
@@ -56,7 +56,7 @@ JAVASCRIPT_ENGINE = $(JS_ENGINE)
# We default to the V8 JS engine on everything except the simulator where
# we stick with JSC.
-ifeq ($(TARGET_SIMULATOR),false)
+ifneq ($(TARGET_SIMULATOR),true)
DEFAULT_ENGINE = v8
ALT_ENGINE = jsc
else
@@ -76,7 +76,7 @@ ifneq ($(JAVASCRIPT_ENGINE),jsc)
endif
# Read the HTTP_STACK environment variable, default is android
-ifeq ($(TARGET_SIMULATOR),false)
+ifneq ($(TARGET_SIMULATOR),true)
HTTP_STACK = $(HTTP)
ifneq ($(HTTP_STACK),android)
# Chrome net stack has dependencies on V8.
diff --git a/LayoutTests/platform/android/test_expectations.txt b/LayoutTests/platform/android/test_expectations.txt
index f2979da..b3757f5 100644
--- a/LayoutTests/platform/android/test_expectations.txt
+++ b/LayoutTests/platform/android/test_expectations.txt
@@ -43,8 +43,6 @@ ietestcenter/Javascript/15.4.4.15-3-8.html SKIP // hangs the layout tests http:/
// This first block of tests are for features for which Android
// should pass all tests. They are skipped only temporarily.
// TODO: Fix these failing tests and remove them from this list.
-fast/dom/Geolocation/delayed-permission-allowed.html IGNORE_RESULT // Requires layoutTestController.permissionSet b/2914450
-fast/dom/Geolocation/delayed-permission-denied.html IGNORE_RESULT // Requires layoutTestController.permissionSet b/2914450
fast/events/touch/basic-multi-touch-events.html IGNORE_RESULT // Requires multi-touch
fast/events/touch/touch-target.html IGNORE_RESULT // Requires multi-touch
http/tests/appcache/empty-manifest.html IGNORE_RESULT // flaky
diff --git a/WebKit/android/WebCoreSupport/WebRequestContext.cpp b/WebKit/android/WebCoreSupport/WebRequestContext.cpp
index 1de066e..6b2fe1b 100644
--- a/WebKit/android/WebCoreSupport/WebRequestContext.cpp
+++ b/WebKit/android/WebCoreSupport/WebRequestContext.cpp
@@ -36,10 +36,14 @@
#include <net/http/http_cache.h>
#include <net/http/http_network_layer.h>
#include <net/proxy/proxy_service.h>
+#include <wtf/text/CString.h>
namespace {
- // TODO: Get uastring from webcore
- std::string userAgent("Mozilla/5.0 (Linux; U; Android 2.1; en-gb; Nexus One Build/ERE21) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17");
+std::string userAgent("Mozilla/5.0 (Linux; U; Android 2.1; en-gb; Nexus One Build/ERE21) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17");
+std::string acceptLanguage("");
+
+Lock userAgentLock;
+Lock acceptLanguageLock;
}
namespace android {
@@ -48,17 +52,39 @@ std::string* WebRequestContext::s_dataDirectory(0);
WebRequestContext::WebRequestContext()
{
+ // Also hardcoded in FrameLoader.java
+ accept_charset_ = "utf-8, iso-8859-1, utf-16, *;q=0.7";
}
WebRequestContext::~WebRequestContext()
{
}
+void WebRequestContext::SetUserAgent(WTF::String string)
+{
+ AutoLock aLock(userAgentLock);
+ userAgent = string.utf8().data();
+ userAgent.append(" alternate http");
+}
+
const std::string& WebRequestContext::GetUserAgent(const GURL& url) const
{
+ AutoLock aLock(userAgentLock);
return userAgent;
}
+void WebRequestContext::SetAcceptLanguage(WTF::String string)
+{
+ AutoLock aLock(acceptLanguageLock);
+ acceptLanguage = string.utf8().data();
+}
+
+const std::string& WebRequestContext::GetAcceptLanguage() const
+{
+ AutoLock aLock(acceptLanguageLock);
+ return acceptLanguage;
+}
+
const std::string* WebRequestContext::GetDataDirectory()
{
if (!s_dataDirectory) {
diff --git a/WebKit/android/WebCoreSupport/WebRequestContext.h b/WebKit/android/WebCoreSupport/WebRequestContext.h
index c321528..a1f7973 100644
--- a/WebKit/android/WebCoreSupport/WebRequestContext.h
+++ b/WebKit/android/WebCoreSupport/WebRequestContext.h
@@ -31,16 +31,23 @@
// a subclass of a chrome class.
#if USE(CHROME_NETWORK_STACK)
-#include "net/http/http_cache.h"
-#include "net/url_request/url_request_context.h"
+#include "PlatformString.h"
+
+#include <net/http/http_cache.h>
+#include <net/url_request/url_request_context.h>
namespace android {
class WebRequestContext : public URLRequestContext {
public:
virtual const std::string& GetUserAgent(const GURL& url) const;
+ virtual const std::string& GetAcceptLanguage() const;
static WebRequestContext* GetAndroidContext();
static WebRequestContext* GetAndroidPrivateBrowsingContext();
+
+ static void SetUserAgent(WTF::String);
+ static void SetAcceptLanguage(WTF::String);
+
private:
static const std::string* GetDataDirectory();
static WebRequestContext* GetAndroidContextForPath(const char* cookiePath, const char* cachePath);
@@ -49,6 +56,7 @@ private:
// Caching this query from java
static std::string* s_dataDirectory;
+ static std::string* s_userAgent;
};
} // namespace android
diff --git a/WebKit/android/jni/WebSettings.cpp b/WebKit/android/jni/WebSettings.cpp
index f389a39..9b84409 100644
--- a/WebKit/android/jni/WebSettings.cpp
+++ b/WebKit/android/jni/WebSettings.cpp
@@ -48,6 +48,7 @@
#if USE(V8)
#include "WorkerContextExecutionProxy.h"
#endif
+#include "WebRequestContext.h"
#include <JNIHelp.h>
#include <utils/misc.h>
@@ -76,6 +77,7 @@ struct FieldIds {
"Ljava/lang/String;");
mUserAgent = env->GetFieldID(clazz, "mUserAgent",
"Ljava/lang/String;");
+ mAcceptLanguage = env->GetFieldID(clazz, "mAcceptLanguage", "Ljava/lang/String;");
mMinimumFontSize = env->GetFieldID(clazz, "mMinimumFontSize", "I");
mMinimumLogicalFontSize = env->GetFieldID(clazz, "mMinimumLogicalFontSize", "I");
mDefaultFontSize = env->GetFieldID(clazz, "mDefaultFontSize", "I");
@@ -130,6 +132,7 @@ struct FieldIds {
LOG_ASSERT(mFantasyFontFamily, "Could not find field mFantasyFontFamily");
LOG_ASSERT(mDefaultTextEncoding, "Could not find field mDefaultTextEncoding");
LOG_ASSERT(mUserAgent, "Could not find field mUserAgent");
+ LOG_ASSERT(mAcceptLanguage, "Could not find field mAcceptLanguage");
LOG_ASSERT(mMinimumFontSize, "Could not find field mMinimumFontSize");
LOG_ASSERT(mMinimumLogicalFontSize, "Could not find field mMinimumLogicalFontSize");
LOG_ASSERT(mDefaultFontSize, "Could not find field mDefaultFontSize");
@@ -177,6 +180,7 @@ struct FieldIds {
jfieldID mFantasyFontFamily;
jfieldID mDefaultTextEncoding;
jfieldID mUserAgent;
+ jfieldID mAcceptLanguage;
jfieldID mMinimumFontSize;
jfieldID mMinimumLogicalFontSize;
jfieldID mDefaultFontSize;
@@ -295,6 +299,11 @@ public:
str = (jstring)env->GetObjectField(obj, gFieldIds->mUserAgent);
WebFrame::getWebFrame(pFrame)->setUserAgent(to_string(env, str));
+#if USE(CHROME_NETWORK_STACK)
+ WebRequestContext::SetUserAgent(to_string(env, str));
+ str = (jstring)env->GetObjectField(obj, gFieldIds->mAcceptLanguage);
+ WebRequestContext::SetAcceptLanguage(to_string(env, str));
+#endif
jint size = env->GetIntField(obj, gFieldIds->mMinimumFontSize);
s->setMinimumFontSize(size);