diff options
author | Luis Hector Chavez <lhchavez@google.com> | 2018-07-30 12:27:53 -0700 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2018-07-30 12:27:53 -0700 |
commit | 97a4dae9b92907e82e47fce8566e6743eb34630a (patch) | |
tree | 039cc0abd213ebd5c4f9df4e664044e974506e69 | |
parent | d81bf36ec797a38abb4c45a73457740ef8007480 (diff) | |
parent | ac54f2ff3ed823f4fe43c5b5735f15e6fe148b2e (diff) | |
download | chromium-libpac-oreo-mr1-1.2-iot-release.tar.gz |
Merge changes I913553e4,I178f6cdeandroid-o-mr1-iot-release-smart-display-r3android-o-mr1-iot-release-1.0.5android-o-mr1-iot-release-1.0.4android-o-mr1-iot-release-1.0.3oreo-mr1-1.2-iot-releasemaster-cuttlefish-testing-release
am: ac54f2ff3e
Change-Id: Ia0b2e0bb03bbae1dd082fe026e211848b32d956e
-rw-r--r-- | Android.mk | 2 | ||||
-rw-r--r-- | test/Android.mk | 2 | ||||
-rw-r--r-- | test/js-unittest/string_functions.js | 3 | ||||
-rw-r--r-- | test/proxy_resolver_v8_unittest.cc | 16 | ||||
-rw-r--r-- | test/proxy_test_script.h | 6 |
5 files changed, 28 insertions, 1 deletions
@@ -29,3 +29,5 @@ LOCAL_SHARED_LIBRARIES := libutils liblog libicuuc libicui18n LOCAL_CXX_STL := libc++ include $(BUILD_SHARED_LIBRARY) + +include $(LOCAL_PATH)/test/Android.mk diff --git a/test/Android.mk b/test/Android.mk index 9c9722e..edf9107 100644 --- a/test/Android.mk +++ b/test/Android.mk @@ -18,6 +18,6 @@ LOCAL_CFLAGS += \ LOCAL_C_INCLUDES += $(LOCAL_PATH)/../src $(LOCAL_PATH)/ external/v8 -LOCAL_SHARED_LIBRARIES := libpac libutils liblog +LOCAL_SHARED_LIBRARIES := libpac libutils liblog libandroid_runtime include $(BUILD_NATIVE_TEST) diff --git a/test/js-unittest/string_functions.js b/test/js-unittest/string_functions.js new file mode 100644 index 0000000..a7c430f --- /dev/null +++ b/test/js-unittest/string_functions.js @@ -0,0 +1,3 @@ +function FindProxyForURL(url, host) { + return "direct".toUpperCase(); +} diff --git a/test/proxy_resolver_v8_unittest.cc b/test/proxy_resolver_v8_unittest.cc index ad9c826..a13f5e5 100644 --- a/test/proxy_resolver_v8_unittest.cc +++ b/test/proxy_resolver_v8_unittest.cc @@ -544,5 +544,21 @@ TEST(ProxyResolverV8Test, DNSResolutionOfInternationDomainName) { EXPECT_EQ("xn--bcher-kva.ch", bindings->dns_resolves_ex[0]); } +TEST(ProxyResolverV8Test, StringPrototype) { + ProxyResolverV8WithMockBindings resolver(new MockJSBindings()); + int result = resolver.SetPacScript(SCRIPT(STRING_FUNCTIONS_JS)); + EXPECT_EQ(OK, result); + + result = resolver.GetProxyForURL(kQueryUrl, kQueryHost, &kResults); + + EXPECT_EQ(OK, result); + std::vector<std::string> proxies = string16ToProxyList(kResults); + EXPECT_EQ(proxies.size(), 1U); + EXPECT_EQ("DIRECT",proxies[0]); + + EXPECT_EQ(0U, resolver.mock_js_bindings()->alerts.size()); + EXPECT_EQ(0U, resolver.mock_js_bindings()->errors.size()); +} + } // namespace } // namespace net diff --git a/test/proxy_test_script.h b/test/proxy_test_script.h index 1042366..dc7bf3c 100644 --- a/test/proxy_test_script.h +++ b/test/proxy_test_script.h @@ -650,6 +650,12 @@ " return \"DIRECT\";\n" \ "}\n" \ +#define STRING_FUNCTIONS_JS \ + "function FindProxyForURL(url, host) {\n" \ + " return \"direct\".toUpperCase();\n" \ + "}\n" \ + "\n" \ + #define UNHANDLED_EXCEPTION_JS \ "function FindProxyForURL(url, host) {\n" \ " // This will throw a runtime exception.\n" \ |