| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 int memoryDeviceConfig = Linker.MEMORY_DEVICE_CONFIG_NORMAL; | 111 int memoryDeviceConfig = Linker.MEMORY_DEVICE_CONFIG_NORMAL; |
| 112 if (hasLowMemoryDeviceSwitch) { | 112 if (hasLowMemoryDeviceSwitch) { |
| 113 memoryDeviceConfig = Linker.MEMORY_DEVICE_CONFIG_LOW; | 113 memoryDeviceConfig = Linker.MEMORY_DEVICE_CONFIG_LOW; |
| 114 } | 114 } |
| 115 Linker linker = Linker.getInstance(); | 115 Linker linker = Linker.getInstance(); |
| 116 linker.setMemoryDeviceConfigForTesting(memoryDeviceConfig); | 116 linker.setMemoryDeviceConfigForTesting(memoryDeviceConfig); |
| 117 | 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).ensureInitiali
zed(); |
| 122 .ensureInitialized(getApplicationContext()); | |
| 123 } catch (ProcessInitException e) { | 122 } catch (ProcessInitException e) { |
| 124 Log.i(TAG, "Cannot load chromium_linker_test:" + e); | 123 Log.i(TAG, "Cannot load chromium_linker_test:" + e); |
| 125 } | 124 } |
| 126 | 125 |
| 127 // Now, start a new renderer process by creating a new view. | 126 // Now, start a new renderer process by creating a new view. |
| 128 // This will run the test runner in the renderer process. | 127 // This will run the test runner in the renderer process. |
| 129 | 128 |
| 130 BrowserStartupController.get(getApplicationContext(), LibraryProcessType
.PROCESS_BROWSER) | 129 BrowserStartupController.get(getApplicationContext(), LibraryProcessType
.PROCESS_BROWSER) |
| 131 .initChromiumBrowserProcessForTests(); | 130 .initChromiumBrowserProcessForTests(); |
| 132 | 131 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 } | 223 } |
| 225 | 224 |
| 226 Shell shell = mShellManager.getActiveShell(); | 225 Shell shell = mShellManager.getActiveShell(); |
| 227 if (shell == null) { | 226 if (shell == null) { |
| 228 return null; | 227 return null; |
| 229 } | 228 } |
| 230 | 229 |
| 231 return shell.getContentViewCore(); | 230 return shell.getContentViewCore(); |
| 232 } | 231 } |
| 233 } | 232 } |
| OLD | NEW |