From 149c6be1bfd4bd84381757940fece1be7b9801aa Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Mon, 31 Dec 2018 18:57:28 -0500 Subject: Enhancement/coroutines (#1273) * Convert rest of fbcookie to suspended methods * Replace active checks with yield * Apply spotless * Switch cookie domain to exact url * Optimize imports and enable travis tests again * Update proguard rules * Remove unnecessary yield * Remove unused flyweight * Remove unused disposable and method * Use contexthelper instead of dispatcher main * Convert login activity to coroutines * Use kau helper methods for coroutines * Enhancement/offline site (#1288) * Begin conversion of offline site logic * Fix offline tests and add validation tests * Ignore cookie in jsoup if it is blank * Force load and zip to be in io * Use different zip files to fix tests * Log all test output * Do not log stdout * Allow test skip for fb offline --- .../pitchedapps/frost/activities/ImageActivityTest.kt | 6 +++--- .../com/pitchedapps/frost/facebook/FbCookieTest.kt | 18 +++++++++++++++++- 2 files changed, 20 insertions(+), 4 deletions(-) (limited to 'app/src/androidTest/kotlin') diff --git a/app/src/androidTest/kotlin/com/pitchedapps/frost/activities/ImageActivityTest.kt b/app/src/androidTest/kotlin/com/pitchedapps/frost/activities/ImageActivityTest.kt index 23f6dab9..d32b956e 100644 --- a/app/src/androidTest/kotlin/com/pitchedapps/frost/activities/ImageActivityTest.kt +++ b/app/src/androidTest/kotlin/com/pitchedapps/frost/activities/ImageActivityTest.kt @@ -62,14 +62,14 @@ class ImageActivityTest { } private val mockServer: MockWebServer by lazy { - val magentaImg = Buffer() - magentaImg.writeAll(Okio.source(getResource("bayer-pattern.jpg"))) + val img = Buffer() + img.writeAll(Okio.source(getResource("bayer-pattern.jpg"))) MockWebServer().apply { setDispatcher(object : Dispatcher() { override fun dispatch(request: RecordedRequest): MockResponse = when { request.path.contains("text") -> MockResponse().setResponseCode(200).setBody("Valid mock text response") - request.path.contains("image") -> MockResponse().setResponseCode(200).setBody(magentaImg) + request.path.contains("image") -> MockResponse().setResponseCode(200).setBody(img) else -> MockResponse().setResponseCode(404).setBody("Error mock response") } }) diff --git a/app/src/androidTest/kotlin/com/pitchedapps/frost/facebook/FbCookieTest.kt b/app/src/androidTest/kotlin/com/pitchedapps/frost/facebook/FbCookieTest.kt index d5c8d2e1..a826391e 100644 --- a/app/src/androidTest/kotlin/com/pitchedapps/frost/facebook/FbCookieTest.kt +++ b/app/src/androidTest/kotlin/com/pitchedapps/frost/facebook/FbCookieTest.kt @@ -1,3 +1,19 @@ +/* + * Copyright 2018 Allan Wang + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ package com.pitchedapps.frost.facebook import android.webkit.CookieManager @@ -10,4 +26,4 @@ class FbCookieTest { fun managerAcceptsCookie() { assertTrue(CookieManager.getInstance().acceptCookie(), "Cookie manager should accept cookie by default") } -} \ No newline at end of file +} -- cgit v1.2.3