OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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.android_webview.test; | 5 package org.chromium.android_webview.test; |
6 | 6 |
7 import android.test.suitebuilder.annotation.SmallTest; | 7 import android.test.suitebuilder.annotation.SmallTest; |
8 import android.util.Pair; | 8 import android.util.Pair; |
9 | 9 |
10 import org.apache.http.Header; | 10 import org.apache.http.Header; |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 final String pageTitle = "Hello, World!"; | 370 final String pageTitle = "Hello, World!"; |
371 int onReceivedTitleCallCount = onReceivedTitleHelper.getCallCount(); | 371 int onReceivedTitleCallCount = onReceivedTitleHelper.getCallCount(); |
372 loadUrlAsync(awContents, "javascript:document.title=\"" + pageTitle
+ "\";void(0);"); | 372 loadUrlAsync(awContents, "javascript:document.title=\"" + pageTitle
+ "\";void(0);"); |
373 onReceivedTitleHelper.waitForCallback(onReceivedTitleCallCount); | 373 onReceivedTitleHelper.waitForCallback(onReceivedTitleCallCount); |
374 assertEquals(pageTitle, onReceivedTitleHelper.getTitle()); | 374 assertEquals(pageTitle, onReceivedTitleHelper.getTitle()); |
375 } finally { | 375 } finally { |
376 webServer.shutdown(); | 376 webServer.shutdown(); |
377 } | 377 } |
378 } | 378 } |
379 | 379 |
380 @SmallTest | |
381 @Feature({"AndroidWebView"}) | |
382 public void testOnReceivedTitleForUnchangingTitle() throws Throwable { | 380 public void testOnReceivedTitleForUnchangingTitle() throws Throwable { |
383 final TestAwContentsClient contentsClient = new TestAwContentsClient(); | 381 final TestAwContentsClient contentsClient = new TestAwContentsClient(); |
384 final AwTestContainerView testContainerView = | 382 final AwTestContainerView testContainerView = |
385 createAwTestContainerViewOnMainSync(contentsClient); | 383 createAwTestContainerViewOnMainSync(contentsClient); |
386 final AwContents awContents = testContainerView.getAwContents(); | 384 final AwContents awContents = testContainerView.getAwContents(); |
387 | 385 |
388 TestWebServer webServer = TestWebServer.start(); | 386 TestWebServer webServer = TestWebServer.start(); |
389 try { | 387 try { |
390 final String title = "Title"; | 388 final String title = "Title"; |
391 final String url1 = webServer.setResponse("/page1.html", | 389 final String url1 = webServer.setResponse("/page1.html", |
(...skipping 10 matching lines...) Expand all Loading... |
402 // onReceivedTitle is still being called. | 400 // onReceivedTitle is still being called. |
403 onReceivedTitleCallCount = onReceivedTitleHelper.getCallCount(); | 401 onReceivedTitleCallCount = onReceivedTitleHelper.getCallCount(); |
404 loadUrlSync(awContents, contentsClient.getOnPageFinishedHelper(), ur
l2); | 402 loadUrlSync(awContents, contentsClient.getOnPageFinishedHelper(), ur
l2); |
405 onReceivedTitleHelper.waitForCallback(onReceivedTitleCallCount); | 403 onReceivedTitleHelper.waitForCallback(onReceivedTitleCallCount); |
406 assertEquals(title, onReceivedTitleHelper.getTitle()); | 404 assertEquals(title, onReceivedTitleHelper.getTitle()); |
407 } finally { | 405 } finally { |
408 webServer.shutdown(); | 406 webServer.shutdown(); |
409 } | 407 } |
410 } | 408 } |
411 } | 409 } |
OLD | NEW |