Esempio n. 1
0
 @Override
 public void tearDown() throws Exception {
   if (mWebServer != null) {
     mWebServer.shutdown();
   }
   super.tearDown();
 }
 @Override
 protected void tearDown() throws Exception {
   try {
     clearCookies();
   } catch (Throwable e) {
     throw new RuntimeException("Could not clear cookies.");
   }
   super.tearDown();
 }
 @Override
 public void setUp() throws Exception {
   super.setUp();
   mServer = new TestWebServer(false);
   mContentsClient = new TestAwContentsClient();
   final AwTestContainerView testContainerView =
       createAwTestContainerViewOnMainSync(mContentsClient);
   mAwContents = testContainerView.getAwContents();
 }
 @Override
 protected void setUp() throws Exception {
   super.setUp();
   AwContents.setShouldDownloadFavicons();
   mContentsClient = new TestAwContentsClient();
   AwTestContainerView testContainerView = createAwTestContainerViewOnMainSync(mContentsClient);
   mAwContents = testContainerView.getAwContents();
   mWebServer = TestWebServer.start();
 }
Esempio n. 5
0
 /**
  * Run video test.
  *
  * @param testCase the test case instance we're going to run the test in.
  * @param requiredUserGesture the settings of MediaPlaybackRequiresUserGesture.
  * @return true if the event happened,
  * @throws Throwable throw exception if timeout.
  */
 public static boolean runVideoTest(
     final AwTestBase testCase,
     final boolean requiredUserGesture,
     final boolean forceVideoOverlay,
     long waitTime)
     throws Throwable {
   final JavascriptEventObserver observer = new JavascriptEventObserver();
   TestAwContentsClient client = new TestAwContentsClient();
   final AwContents awContents =
       testCase.createAwTestContainerViewOnMainSync(client).getAwContents();
   testCase
       .getInstrumentation()
       .runOnMainSync(
           new Runnable() {
             @Override
             public void run() {
               AwSettings awSettings = awContents.getSettings();
               awSettings.setJavaScriptEnabled(true);
               awSettings.setMediaPlaybackRequiresUserGesture(requiredUserGesture);
               awSettings.setForceVideoOverlayForTests(forceVideoOverlay);
               observer.register(awContents.getContentViewCore(), "javaObserver");
             }
           });
   VideoTestWebServer webServer = new VideoTestWebServer();
   try {
     String data =
         "<html><head><script>"
             + "addEventListener('DOMContentLoaded', function() { "
             + "  document.getElementById('video').addEventListener('play', function() { "
             + "    javaObserver.notifyJava(); "
             + "  }, false); "
             + "}, false); "
             + "</script></head><body>"
             + "<video id='video' autoplay control src='"
             + webServer.getOnePixelOneFrameWebmURL()
             + "' /> </body></html>";
     testCase.loadDataAsync(awContents, data, "text/html", false);
     return observer.waitForEvent(waitTime);
   } finally {
     if (webServer != null && webServer.getTestWebServer() != null) {
       webServer.getTestWebServer().shutdown();
     }
   }
 }
Esempio n. 6
0
 @Override
 public void setUp() throws Exception {
   super.setUp();
   mContentsClient = new TestAwContentsClient();
   mTestView = createAwTestContainerViewOnMainSync(mContentsClient);
   mAwContents = mTestView.getAwContents();
   mWebServer = TestWebServer.start();
   final String imagePath = "/" + CommonResources.TEST_IMAGE_FILENAME;
   mWebServer.setResponseBase64(
       imagePath, CommonResources.FAVICON_DATA_BASE64, CommonResources.getImagePngHeaders(true));
 }
  @Override
  protected void setUp() throws Exception {
    super.setUp();

    mCookieManager = new AwCookieManager();
    mContentsClient = new TestAwContentsClient();
    final AwTestContainerView testContainerView =
        createAwTestContainerViewOnMainSync(mContentsClient);
    mAwContents = testContainerView.getAwContents();
    mAwContents.getSettings().setJavaScriptEnabled(true);
    assertNotNull(mCookieManager);

    mCookieManager.setAcceptCookie(true);
    assertTrue(mCookieManager.acceptCookie());
  }
  @Override
  public void setUp() throws Exception {
    super.setUp();
    mContentsClient = new TestAwContentsClient();
    mTestView = createAwTestContainerViewOnMainSync(mContentsClient);
    mAwContents = mTestView.getAwContents();
    mWebServer = TestWebServer.start();
    mOrigin = mWebServer.getBaseUrl();

    AwSettings settings = getAwSettingsOnUiThread(mAwContents);
    settings.setJavaScriptEnabled(true);
    settings.setDomStorageEnabled(true);
    settings.setAppCacheEnabled(true);
    settings.setAppCachePath("whatever"); // Enables AppCache.
  }
 @Override
 public void tearDown() throws Exception {
   mServer.shutdown();
   super.tearDown();
 }
 @Override
 protected void tearDown() throws Exception {
   if (mWebServer != null) mWebServer.shutdown();
   super.tearDown();
 }
 @Override
 public void setUp() throws Exception {
   super.setUp();
   mWebServer = TestWebServer.start();
 }
 @Override
 protected void setUp() throws Exception {
   super.setUp();
   mWebServer = TestWebServer.start();
 }