Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(416)

Side by Side Diff: chrome/android/javatests/src/org/chromium/chrome/browser/EncodingDetectionTest.java

Issue 1894913002: Android: turn on auto-detect encoding by default (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build error Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.chrome.browser;
6
7 import android.os.Environment;
8 import android.test.suitebuilder.annotation.SmallTest;
9
10 import org.chromium.base.test.util.Feature;
11 import org.chromium.chrome.test.ChromeActivityTestCaseBase;
12 import org.chromium.net.test.EmbeddedTestServer;
13
14 /**
15 * Tests text encoding detection.
16 */
17 public class EncodingDetectionTest extends ChromeActivityTestCaseBase<ChromeActi vity> {
18
19 // TODO(jinsukkim): Fix and enable BrowserEncodingTest::TestEncodingAutoDete ct()
20 // once auto-detection turns on for desktop platforms. Then this test ca n
21 // be removed safely since the native part handling encoding detection i s
22 // shared with Android platform.
23
24 private EmbeddedTestServer mTestServer;
25
26 public EncodingDetectionTest() {
27 super(ChromeActivity.class);
28 }
29
30 @Override
31 protected void setUp() throws Exception {
32 super.setUp();
33
34 mTestServer = EmbeddedTestServer.createAndStartFileServer(
35 getInstrumentation().getContext(), Environment.getExternalStorag eDirectory());
36 }
37
38 @Override
39 protected void tearDown() throws Exception {
40 mTestServer.stopAndDestroyServer();
41 super.tearDown();
42 }
43
44 @Override
45 public void startMainActivity() throws InterruptedException {
46 startMainActivityOnBlankPage();
47 }
48
49 @SmallTest
50 @Feature({"Encoding"})
51 public void testAutodetectEncoding() throws Exception {
52
53 String testUrl = mTestServer.getURL(
54 "/chrome/test/data/encoding_tests/auto_detect/"
55 + "Big5_with_no_encoding_specified.html");
56 loadUrl(testUrl);
57 assertEquals("Wrong page encoding detected", "Big5",
58 getActivity().getCurrentContentViewCore().getWebContents().getEn coding());
59 }
60 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698