Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: adblock-android-tests/src/org/adblockplus/libadblockplus/tests/BasePlatformTest.java

Issue 29819555: Fix libadblockplus-android tests
Patch Set: Fixed indentation issues. Created Aug. 27, 2018, 8:03 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH
4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation.
8 *
9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 package org.adblockplus.libadblockplus.tests;
19
20 import org.adblockplus.libadblockplus.Platform;
21
22 import org.adblockplus.libadblockplus.LogSystem;
23 import org.adblockplus.libadblockplus.ThrowingWebRequest;
24 import org.adblockplus.libadblockplus.WebRequest;
25
26 import android.content.Context;
27 import android.test.InstrumentationTestCase;
28
29 public abstract class BasePlatformTest extends InstrumentationTestCase
30 {
31 protected Platform platform;
32
33 @Override
34 protected void setUp() throws Exception
35 {
36 super.setUp();
37
38 platform = new Platform(createLogSystem(), createWebRequest(),
39 getContext().getFilesDir().getAbsolutePath());
40 }
41
42 @Override
43 protected void tearDown() throws Exception
44 {
45 if (platform != null)
46 {
47 platform.dispose();
48 platform = null;
49 }
50 super.tearDown();
51 }
52
53 // If the method returns null then a default implementation of the Log System
54 // provided by libadblockplus is used.
55 protected LogSystem createLogSystem()
56 {
57 return null;
58 }
59
60 protected WebRequest createWebRequest()
61 {
62 return new ThrowingWebRequest();
63 }
64
65 protected Context getContext()
66 {
67 return getInstrumentation().getTargetContext();
68 }
69 }
OLDNEW

Powered by Google App Engine
This is Rietveld