<commit_before>/* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*-
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

package org.mozilla.focus.privacy;

import android.content.Context;
import android.preference.PreferenceManager;
import android.support.test.InstrumentationRegistry;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.support.test.uiautomator.UiObjectNotFoundException;
import android.util.Log;

import junit.framework.Assert;

import org.junit.After;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mozilla.focus.activity.MainActivity;
import org.mozilla.focus.helpers.TestHelper;
import org.mozilla.focus.utils.AppConstants;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;

import okhttp3.mockwebserver.MockResponse;
import okhttp3.mockwebserver.MockWebServer;
import okhttp3.mockwebserver.RecordedRequest;

import static android.support.test.espresso.action.ViewActions.click;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mozilla.focus.fragment.FirstrunFragment.FIRSTRUN_PREF;
import static org.mozilla.focus.helpers.TestHelper.waitingTime;

/**
 * This test browses to a test site and makes sure that no traces are left on disk.
 *
 * The test uses a whitelist so it might fail as soon as you store new files on disk.
 */
@RunWith(AndroidJUnit4.class)
public class WebViewDataTest {
    private static final String LOGTAG = "WebViewDataTest";

    /**
     * A list of files Android Studio will inject into the data dir if you:
     * - Build with Android Studio 3.0+
     * - Have opened the "Android Profiler" tab at least once since the AS process started
     * - Run on an API 26+ device (or maybe when explicitly enabling advanced debugging on older devices)
     */
    private static final Set<String> ANDROID_PROFILER_FILES = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(
            "libperfa_x86.so",
            "perfa.jar",
            "perfd"
    )));
<commit_msg>Disable webview test that permanently fails, see https://github.com/mozilla-mobile/focus-android/issues/2940<commit_after>/* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*-
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

package org.mozilla.focus.privacy;

import android.content.Context;
import android.preference.PreferenceManager;
import android.support.test.InstrumentationRegistry;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.support.test.uiautomator.UiObjectNotFoundException;
import android.util.Log;

import junit.framework.Assert;

import org.junit.After;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mozilla.focus.activity.MainActivity;
import org.mozilla.focus.helpers.TestHelper;
import org.mozilla.focus.utils.AppConstants;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;

import okhttp3.mockwebserver.MockResponse;
import okhttp3.mockwebserver.MockWebServer;
import okhttp3.mockwebserver.RecordedRequest;

import static android.support.test.espresso.action.ViewActions.click;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mozilla.focus.fragment.FirstrunFragment.FIRSTRUN_PREF;
import static org.mozilla.focus.helpers.TestHelper.waitingTime;

/**
 * This test browses to a test site and makes sure that no traces are left on disk.
 *
 * The test uses a whitelist so it might fail as soon as you store new files on disk.
 */
@RunWith(AndroidJUnit4.class)
@Ignore("This test fails permanently, see https://github.com/mozilla-mobile/focus-android/issues/2940")
public class WebViewDataTest {
    private static final String LOGTAG = "WebViewDataTest";

    /**
     * A list of files Android Studio will inject into the data dir if you:
     * - Build with Android Studio 3.0+
     * - Have opened the "Android Profiler" tab at least once since the AS process started
     * - Run on an API 26+ device (or maybe when explicitly enabling advanced debugging on older devices)
     */
    private static final Set<String> ANDROID_PROFILER_FILES = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(
            "libperfa_x86.so",
            "perfa.jar",
            "perfd"
    )));

{'fraction_non_alphanumeric': 0.09655172413793103, 'fraction_numerical': 0.008045977011494253, 'mean_word_length': 4.327551020408163, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6542494', 'n_tokens_mistral': 1564, 'n_tokens_neox': 1535, 'n_words': 457}