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.chromium_linker_test_apk; | 5 package org.chromium.chromium_linker_test_apk; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.content.Intent; | 9 import android.content.Intent; |
10 import android.os.Bundle; | 10 import android.os.Bundle; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 } | 90 } |
91 | 91 |
92 if (!(hasModernLinkerSwitch || hasLegacyLinkerSwitch)) { | 92 if (!(hasModernLinkerSwitch || hasLegacyLinkerSwitch)) { |
93 Log.e(TAG, "Missing --use-linker command line argument."); | 93 Log.e(TAG, "Missing --use-linker command line argument."); |
94 finish(); | 94 finish(); |
95 } else if (hasModernLinkerSwitch && hasLegacyLinkerSwitch) { | 95 } else if (hasModernLinkerSwitch && hasLegacyLinkerSwitch) { |
96 Log.e(TAG, "Conflicting --use-linker command line arguments."); | 96 Log.e(TAG, "Conflicting --use-linker command line arguments."); |
97 finish(); | 97 finish(); |
98 } | 98 } |
99 | 99 |
100 // Set the requested Linker implementation from the command-line. | 100 // Set the requested Linker implementation from the command-line, and |
| 101 // register the test runner class by name. |
101 if (hasModernLinkerSwitch) { | 102 if (hasModernLinkerSwitch) { |
102 Linker.setLinkerImplementationForTesting(Linker.LINKER_IMPLEMENTATIO
N_MODERN); | 103 Linker.setupForTesting(Linker.LINKER_IMPLEMENTATION_MODERN, |
| 104 LinkerTests.class.getName()); |
103 } else { | 105 } else { |
104 Linker.setLinkerImplementationForTesting(Linker.LINKER_IMPLEMENTATIO
N_LEGACY); | 106 Linker.setupForTesting(Linker.LINKER_IMPLEMENTATION_LEGACY, |
| 107 LinkerTests.class.getName()); |
105 } | 108 } |
106 | 109 |
107 // Determine which kind of device to simulate from the command-line. | 110 // Determine which kind of device to simulate from the command-line. |
108 int memoryDeviceConfig = Linker.MEMORY_DEVICE_CONFIG_NORMAL; | 111 int memoryDeviceConfig = Linker.MEMORY_DEVICE_CONFIG_NORMAL; |
109 if (hasLowMemoryDeviceSwitch) { | 112 if (hasLowMemoryDeviceSwitch) { |
110 memoryDeviceConfig = Linker.MEMORY_DEVICE_CONFIG_LOW; | 113 memoryDeviceConfig = Linker.MEMORY_DEVICE_CONFIG_LOW; |
111 } | 114 } |
112 Linker linker = Linker.getInstance(); | 115 Linker linker = Linker.getInstance(); |
113 linker.setMemoryDeviceConfigForTesting(memoryDeviceConfig); | 116 linker.setMemoryDeviceConfigForTesting(memoryDeviceConfig); |
114 | 117 |
115 // Register the test runner class by name. | |
116 linker.setTestRunnerClassNameForTesting(LinkerTests.class.getName()); | |
117 | |
118 // Load the library in the browser process, this will also run the test | 118 // Load the library in the browser process, this will also run the test |
119 // runner in this process. | 119 // runner in this process. |
120 try { | 120 try { |
121 LibraryLoader.get(LibraryProcessType.PROCESS_BROWSER) | 121 LibraryLoader.get(LibraryProcessType.PROCESS_BROWSER) |
122 .ensureInitialized(getApplicationContext()); | 122 .ensureInitialized(getApplicationContext()); |
123 } catch (ProcessInitException e) { | 123 } catch (ProcessInitException e) { |
124 Log.i(TAG, "Cannot load chromium_linker_test:" + e); | 124 Log.i(TAG, "Cannot load chromium_linker_test:" + e); |
125 } | 125 } |
126 | 126 |
127 // Now, start a new renderer process by creating a new view. | 127 // Now, start a new renderer process by creating a new view. |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 } | 223 } |
224 | 224 |
225 Shell shell = mShellManager.getActiveShell(); | 225 Shell shell = mShellManager.getActiveShell(); |
226 if (shell == null) { | 226 if (shell == null) { |
227 return null; | 227 return null; |
228 } | 228 } |
229 | 229 |
230 return shell.getContentViewCore(); | 230 return shell.getContentViewCore(); |
231 } | 231 } |
232 } | 232 } |
OLD | NEW |