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.test.suitebuilder.annotation.SmallTest; | 7 import android.test.suitebuilder.annotation.SmallTest; |
8 | 8 |
9 import org.chromium.base.test.util.Feature; | 9 import org.chromium.base.test.util.Feature; |
| 10 import org.chromium.content.browser.ContentViewRenderView; |
10 | 11 |
11 public class ChromiumTestShellUrlTest extends ChromiumTestShellTestBase { | 12 public class ChromiumTestShellUrlTest extends ChromiumTestShellTestBase { |
12 // URL used for base tests. | 13 // URL used for base tests. |
13 private static final String URL = "data:text"; | 14 private static final String URL = "data:text"; |
14 | 15 |
15 @SmallTest | 16 @SmallTest |
16 @Feature({"Main"}) | 17 @Feature({"Main"}) |
17 public void testBaseStartup() throws Exception { | 18 public void testBaseStartup() throws Exception { |
18 ChromiumTestShellActivity activity = launchChromiumTestShellWithUrl(URL)
; | 19 ChromiumTestShellActivity activity = launchChromiumTestShellWithUrl(URL)
; |
19 waitForActiveShellToBeDoneLoading(); | 20 waitForActiveShellToBeDoneLoading(); |
20 | 21 |
21 // Make sure the activity was created as expected. | 22 // Make sure the activity was created as expected. |
22 assertNotNull(activity); | 23 assertNotNull(activity); |
23 } | 24 } |
| 25 |
| 26 /** |
| 27 * Tests that creating an extra ContentViewRenderView does not cause an asse
rt because we would |
| 28 * initialize the compositor twice http://crbug.com/162312 |
| 29 */ |
| 30 @SmallTest |
| 31 @Feature({"Main"}) |
| 32 public void testCompositorInit() throws Exception { |
| 33 // Start the ChromiumTestShell, this loads the native library and create
an instance of |
| 34 // ContentViewRenderView. |
| 35 final ChromiumTestShellActivity activity = launchChromiumTestShellWithUr
l(URL); |
| 36 waitForActiveShellToBeDoneLoading(); |
| 37 |
| 38 // Now create a new ContentViewRenderView, it should not assert. |
| 39 try { |
| 40 runTestOnUiThread(new Runnable() { |
| 41 @Override |
| 42 public void run() { |
| 43 ContentViewRenderView contentViewRenderView = |
| 44 new ContentViewRenderView(getInstrumentation().getTa
rgetContext()); |
| 45 contentViewRenderView.setCurrentContentView(activity.getActi
veContentView()); |
| 46 } |
| 47 }); |
| 48 } catch (Throwable e) { |
| 49 fail("Could not create a ContentViewRenderView: " + e); |
| 50 } |
| 51 } |
24 } | 52 } |
OLD | NEW |