| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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.native_test; | 5 package org.chromium.native_test; |
| 6 | 6 |
| 7 import android.app.Activity; | 7 import android.app.Activity; |
| 8 import android.app.Instrumentation; | 8 import android.app.Instrumentation; |
| 9 import android.content.ComponentName; | 9 import android.content.ComponentName; |
| 10 import android.content.Intent; | 10 import android.content.Intent; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 | 102 |
| 103 File portFile = new File( | 103 File portFile = new File( |
| 104 Environment.getExternalStorageDirectory(), "net-test-ser
ver-ports"); | 104 Environment.getExternalStorageDirectory(), "net-test-ser
ver-ports"); |
| 105 OutputStreamWriter writer = | 105 OutputStreamWriter writer = |
| 106 new OutputStreamWriter(new FileOutputStream(portFile)); | 106 new OutputStreamWriter(new FileOutputStream(portFile)); |
| 107 writer.write(Integer.toString(mTestServerSpawner.getServerPort()
) + ":0"); | 107 writer.write(Integer.toString(mTestServerSpawner.getServerPort()
) + ":0"); |
| 108 writer.close(); | 108 writer.close(); |
| 109 | 109 |
| 110 mTestServerSpawnerThread = new Thread(mTestServerSpawner); | 110 mTestServerSpawnerThread = new Thread(mTestServerSpawner); |
| 111 mTestServerSpawnerThread.start(); | 111 mTestServerSpawnerThread.start(); |
| 112 mTestServerSpawner.waitForServerToStart(); |
| 112 } catch (IOException e) { | 113 } catch (IOException e) { |
| 113 Log.e(TAG, "Error creating TestServerSpawner: " + e.toString()); | 114 Log.e(TAG, "Error creating TestServerSpawner: " + e.toString()); |
| 114 } | 115 } |
| 115 } | 116 } |
| 116 } | 117 } |
| 117 | 118 |
| 118 private void tearDown() { | 119 private void tearDown() { |
| 119 if (mTestServerSpawnerThread != null) { | 120 if (mTestServerSpawnerThread != null) { |
| 120 try { | 121 try { |
| 121 mTestServerSpawner.stop(); | 122 mTestServerSpawner.stop(); |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 } else { | 273 } else { |
| 273 resultBuilder.append("\nOK (" + Integer.toString(testsPassed) +
" tests)"); | 274 resultBuilder.append("\nOK (" + Integer.toString(testsPassed) +
" tests)"); |
| 274 } | 275 } |
| 275 resultsBundle.putString(Instrumentation.REPORT_KEY_STREAMRESULT, | 276 resultsBundle.putString(Instrumentation.REPORT_KEY_STREAMRESULT, |
| 276 resultBuilder.toString()); | 277 resultBuilder.toString()); |
| 277 return resultsBundle; | 278 return resultsBundle; |
| 278 } | 279 } |
| 279 } | 280 } |
| 280 | 281 |
| 281 } | 282 } |
| OLD | NEW |