Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / chrome / android / shell / javatests / src / org / chromium / chrome / shell / ChromeShellUrlTest.java
index 7dd0eb4..c133ec7 100644 (file)
@@ -8,14 +8,17 @@ import android.test.suitebuilder.annotation.SmallTest;
 
 import org.chromium.base.ThreadUtils;
 import org.chromium.base.test.util.Feature;
-import org.chromium.content.browser.ContentView;
 import org.chromium.content.browser.ContentViewCore;
 import org.chromium.content.browser.ContentViewRenderView;
+import org.chromium.ui.base.WindowAndroid;
 
 import java.util.Locale;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicReference;
 
+/**
+ * Basic sanity test for loading urls in ChromeShell.
+ */
 public class ChromeShellUrlTest extends ChromeShellTestBase {
     // URL used for base tests.
     private static final String URL = "data:text";
@@ -40,22 +43,17 @@ public class ChromeShellUrlTest extends ChromeShellTestBase {
         // Make sure the activity was created as expected.
         assertNotNull(activity);
 
-        // Ensure we have a ContentView and ContentViewCore.
-        final AtomicReference<ContentView> contentView = new AtomicReference<ContentView>();
+        // Ensure we have a valid ContentViewCore.
         final AtomicReference<ContentViewCore> contentViewCore =
                 new AtomicReference<ContentViewCore>();
         ThreadUtils.runOnUiThreadBlocking(new Runnable() {
             @Override
             public void run() {
-                ContentView activeContentView = activity.getActiveContentView();
-                contentView.set(activeContentView);
-                if (activeContentView != null) {
-                    contentViewCore.set(activeContentView.getContentViewCore());
-                }
+                contentViewCore.set(activity.getActiveContentViewCore());
             }
         });
-        assertNotNull(contentView.get());
         assertNotNull(contentViewCore.get());
+        assertNotNull(contentViewCore.get().getContainerView());
 
         // Ensure the correct page has been loaded, ie. not interstitial, and title/url should
         // be sane. Note, a typical correct title is: "Welcome to Chromium", whereas a wrong one
@@ -98,14 +96,18 @@ public class ChromeShellUrlTest extends ChromeShellTestBase {
             runTestOnUiThread(new Runnable() {
                 @Override
                 public void run() {
+                    WindowAndroid windowAndroid = new WindowAndroid(
+                            getInstrumentation().getTargetContext().getApplicationContext());
                     ContentViewRenderView contentViewRenderView =
                             new ContentViewRenderView(getInstrumentation().getTargetContext(),
-                                    activity.getWindowAndroid());
-                    contentViewRenderView.setCurrentContentView(activity.getActiveContentView());
+                                    windowAndroid);
+                    contentViewRenderView.setCurrentContentViewCore(
+                            activity.getActiveContentViewCore());
                 }
             });
         } catch (Throwable e) {
+            e.printStackTrace();
             fail("Could not create a ContentViewRenderView: " + e);
         }
     }
-}
\ No newline at end of file
+}