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

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

Issue 2431753003: Merge EmbeddedTestServer#createAndStartDefaultServer() and createAndStartFileServer() (Closed)
Patch Set: Created 4 years, 2 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser.customtabs; 5 package org.chromium.chrome.browser.customtabs;
6 6
7 import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_NON_LOW_E ND_DEVICE; 7 import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_NON_LOW_E ND_DEVICE;
8 8
9 import android.app.Activity; 9 import android.app.Activity;
10 import android.app.Application; 10 import android.app.Application;
11 import android.app.Instrumentation; 11 import android.app.Instrumentation;
12 import android.app.Instrumentation.ActivityMonitor; 12 import android.app.Instrumentation.ActivityMonitor;
13 import android.app.Instrumentation.ActivityResult; 13 import android.app.Instrumentation.ActivityResult;
14 import android.app.PendingIntent; 14 import android.app.PendingIntent;
15 import android.content.ComponentName; 15 import android.content.ComponentName;
16 import android.content.Context; 16 import android.content.Context;
17 import android.content.Intent; 17 import android.content.Intent;
18 import android.content.IntentFilter; 18 import android.content.IntentFilter;
19 import android.content.res.Resources; 19 import android.content.res.Resources;
20 import android.graphics.Bitmap; 20 import android.graphics.Bitmap;
21 import android.graphics.Color; 21 import android.graphics.Color;
22 import android.graphics.drawable.BitmapDrawable; 22 import android.graphics.drawable.BitmapDrawable;
23 import android.graphics.drawable.ColorDrawable; 23 import android.graphics.drawable.ColorDrawable;
24 import android.net.Uri; 24 import android.net.Uri;
25 import android.os.Build; 25 import android.os.Build;
26 import android.os.Bundle; 26 import android.os.Bundle;
27 import android.os.Environment;
28 import android.support.customtabs.CustomTabsCallback; 27 import android.support.customtabs.CustomTabsCallback;
29 import android.support.customtabs.CustomTabsClient; 28 import android.support.customtabs.CustomTabsClient;
30 import android.support.customtabs.CustomTabsIntent; 29 import android.support.customtabs.CustomTabsIntent;
31 import android.support.customtabs.CustomTabsServiceConnection; 30 import android.support.customtabs.CustomTabsServiceConnection;
32 import android.support.customtabs.CustomTabsSession; 31 import android.support.customtabs.CustomTabsSession;
33 import android.support.customtabs.CustomTabsSessionToken; 32 import android.support.customtabs.CustomTabsSessionToken;
34 import android.test.suitebuilder.annotation.SmallTest; 33 import android.test.suitebuilder.annotation.SmallTest;
35 import android.text.TextUtils; 34 import android.text.TextUtils;
36 import android.view.Menu; 35 import android.view.Menu;
37 import android.view.MenuItem; 36 import android.view.MenuItem;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 105
107 private CustomTabActivity mActivity; 106 private CustomTabActivity mActivity;
108 private String mTestPage; 107 private String mTestPage;
109 private String mTestPage2; 108 private String mTestPage2;
110 private EmbeddedTestServer mTestServer; 109 private EmbeddedTestServer mTestServer;
111 110
112 @Override 111 @Override
113 protected void setUp() throws Exception { 112 protected void setUp() throws Exception {
114 super.setUp(); 113 super.setUp();
115 Context appContext = getInstrumentation().getTargetContext().getApplicat ionContext(); 114 Context appContext = getInstrumentation().getTargetContext().getApplicat ionContext();
116 mTestServer = EmbeddedTestServer.createAndStartFileServer( 115 mTestServer = EmbeddedTestServer.createAndStartServer(appContext);
117 appContext, Environment.getExternalStorageDirectory());
118 mTestPage = mTestServer.getURL(TEST_PAGE); 116 mTestPage = mTestServer.getURL(TEST_PAGE);
119 mTestPage2 = mTestServer.getURL(TEST_PAGE_2); 117 mTestPage2 = mTestServer.getURL(TEST_PAGE_2);
120 PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX); 118 PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX);
121 LibraryLoader.get(LibraryProcessType.PROCESS_BROWSER).ensureInitialized( ); 119 LibraryLoader.get(LibraryProcessType.PROCESS_BROWSER).ensureInitialized( );
122 } 120 }
123 121
124 @Override 122 @Override
125 protected void tearDown() throws Exception { 123 protected void tearDown() throws Exception {
126 mTestServer.stopAndDestroyServer(); 124 mTestServer.stopAndDestroyServer();
127 125
(...skipping 1419 matching lines...) Expand 10 before | Expand all | Expand 10 after
1547 if (jsonText.equalsIgnoreCase("null")) jsonText = ""; 1545 if (jsonText.equalsIgnoreCase("null")) jsonText = "";
1548 value = jsonText; 1546 value = jsonText;
1549 } catch (InterruptedException | TimeoutException e) { 1547 } catch (InterruptedException | TimeoutException e) {
1550 e.printStackTrace(); 1548 e.printStackTrace();
1551 return false; 1549 return false;
1552 } 1550 }
1553 return TextUtils.equals(mExpected, value); 1551 return TextUtils.equals(mExpected, value);
1554 } 1552 }
1555 } 1553 }
1556 } 1554 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698