| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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.testshell; | 5 package org.chromium.chrome.testshell; |
| 6 | 6 |
| 7 import android.app.Activity; | 7 import android.app.Activity; |
| 8 import android.content.Intent; | 8 import android.content.Intent; |
| 9 import android.os.Bundle; | 9 import android.os.Bundle; |
| 10 import android.text.TextUtils; | 10 import android.text.TextUtils; |
| 11 import android.util.Log; | 11 import android.util.Log; |
| 12 import android.view.KeyEvent; | 12 import android.view.KeyEvent; |
| 13 import android.view.Menu; | 13 import android.view.Menu; |
| 14 import android.view.MenuInflater; | 14 import android.view.MenuInflater; |
| 15 import android.view.MenuItem; | 15 import android.view.MenuItem; |
| 16 import android.widget.Toast; | 16 import android.widget.Toast; |
| 17 | 17 |
| 18 import org.chromium.base.MemoryPressureListener; | 18 import org.chromium.base.MemoryPressureListener; |
| 19 import org.chromium.chrome.browser.DevToolsServer; | 19 import org.chromium.chrome.browser.DevToolsServer; |
| 20 import org.chromium.chrome.testshell.sync.SyncController; | 20 import org.chromium.chrome.testshell.sync.SyncController; |
| 21 import org.chromium.content.browser.ActivityContentVideoViewClient; | 21 import org.chromium.content.browser.ActivityContentVideoViewClient; |
| 22 import org.chromium.content.browser.BrowserStartupController; | 22 import org.chromium.content.browser.BrowserStartupController; |
| 23 import org.chromium.content.browser.ContentVideoViewClient; | 23 import org.chromium.content.browser.ContentVideoViewClient; |
| 24 import org.chromium.content.browser.ContentView; | 24 import org.chromium.content.browser.ContentView; |
| 25 import org.chromium.content.browser.ContentViewClient; | 25 import org.chromium.content.browser.ContentViewClient; |
| 26 import org.chromium.content.browser.DeviceUtils; | 26 import org.chromium.content.browser.DeviceUtils; |
| 27 import org.chromium.content.browser.TracingControllerAndroid; | |
| 28 import org.chromium.content.common.CommandLine; | 27 import org.chromium.content.common.CommandLine; |
| 29 import org.chromium.sync.signin.ChromeSigninController; | 28 import org.chromium.sync.signin.ChromeSigninController; |
| 29 import org.chromium.ui.ActivityWindowAndroid; |
| 30 import org.chromium.ui.WindowAndroid; | 30 import org.chromium.ui.WindowAndroid; |
| 31 | 31 |
| 32 /** | 32 /** |
| 33 * The {@link android.app.Activity} component of a basic test shell to test Chro
me features. | 33 * The {@link android.app.Activity} component of a basic test shell to test Chro
me features. |
| 34 */ | 34 */ |
| 35 public class ChromiumTestShellActivity extends Activity implements MenuHandler { | 35 public class ChromiumTestShellActivity extends Activity implements MenuHandler { |
| 36 private static final String TAG = "ChromiumTestShellActivity"; | 36 private static final String TAG = "ChromiumTestShellActivity"; |
| 37 | 37 |
| 38 private WindowAndroid mWindow; | 38 private WindowAndroid mWindow; |
| 39 private TabManager mTabManager; | 39 private TabManager mTabManager; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 private void finishInitialization(final Bundle savedInstanceState) { | 71 private void finishInitialization(final Bundle savedInstanceState) { |
| 72 setContentView(R.layout.testshell_activity); | 72 setContentView(R.layout.testshell_activity); |
| 73 mTabManager = (TabManager) findViewById(R.id.tab_manager); | 73 mTabManager = (TabManager) findViewById(R.id.tab_manager); |
| 74 String startupUrl = getUrlFromIntent(getIntent()); | 74 String startupUrl = getUrlFromIntent(getIntent()); |
| 75 if (!TextUtils.isEmpty(startupUrl)) { | 75 if (!TextUtils.isEmpty(startupUrl)) { |
| 76 mTabManager.setStartupUrl(startupUrl); | 76 mTabManager.setStartupUrl(startupUrl); |
| 77 } | 77 } |
| 78 TestShellToolbar mToolbar = (TestShellToolbar) findViewById(R.id.toolbar
); | 78 TestShellToolbar mToolbar = (TestShellToolbar) findViewById(R.id.toolbar
); |
| 79 mToolbar.setMenuHandler(this); | 79 mToolbar.setMenuHandler(this); |
| 80 | 80 |
| 81 mWindow = new WindowAndroid(this); | 81 mWindow = new ActivityWindowAndroid(this); |
| 82 mWindow.restoreInstanceState(savedInstanceState); | 82 mWindow.restoreInstanceState(savedInstanceState); |
| 83 mTabManager.setWindow(mWindow); | 83 mTabManager.setWindow(mWindow); |
| 84 | 84 |
| 85 mDevToolsServer = new DevToolsServer("chromium_testshell"); | 85 mDevToolsServer = new DevToolsServer("chromium_testshell"); |
| 86 mDevToolsServer.setRemoteDebuggingEnabled(true); | 86 mDevToolsServer.setRemoteDebuggingEnabled(true); |
| 87 mSyncController = SyncController.get(this); | 87 mSyncController = SyncController.get(this); |
| 88 // In case this method is called after the first onStart(), we need to i
nform the | 88 // In case this method is called after the first onStart(), we need to i
nform the |
| 89 // SyncController that we have started. | 89 // SyncController that we have started. |
| 90 mSyncController.onStart(); | 90 mSyncController.onStart(); |
| 91 } | 91 } |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 Log.e(TAG, "Waiting for Java debugger to connect..."); | 229 Log.e(TAG, "Waiting for Java debugger to connect..."); |
| 230 android.os.Debug.waitForDebugger(); | 230 android.os.Debug.waitForDebugger(); |
| 231 Log.e(TAG, "Java debugger connected. Resuming execution."); | 231 Log.e(TAG, "Java debugger connected. Resuming execution."); |
| 232 } | 232 } |
| 233 } | 233 } |
| 234 | 234 |
| 235 private static String getUrlFromIntent(Intent intent) { | 235 private static String getUrlFromIntent(Intent intent) { |
| 236 return intent != null ? intent.getDataString() : null; | 236 return intent != null ? intent.getDataString() : null; |
| 237 } | 237 } |
| 238 } | 238 } |
| OLD | NEW |