Skip to content

Commit b0668e4

Browse files
committed
follow up file original policy change
enable the access for webview test Change-Id: Iebde5f3175eabf6e084dc1a2fe8b9dce280ebe7c
1 parent ad04c9c commit b0668e4

File tree

1 file changed

+35
-2
lines changed

1 file changed

+35
-2
lines changed

tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,12 +257,14 @@ private void moveToNextTest() {
257257
builder.setMessage("All tests finished. Exit?")
258258
.setCancelable(false)
259259
.setPositiveButton("Yes", new OnClickListener(){
260-
public void onClick(DialogInterface dialog, int which) {
260+
@Override
261+
public void onClick(DialogInterface dialog, int which) {
261262
TestShellActivity.this.finish();
262263
}
263264
})
264265
.setNegativeButton("No", new OnClickListener(){
265-
public void onClick(DialogInterface dialog, int which) {
266+
@Override
267+
public void onClick(DialogInterface dialog, int which) {
266268
dialog.cancel();
267269
}
268270
});
@@ -370,6 +372,7 @@ public void setDefaultDumpDataType(DumpDataType defaultDumpDataType) {
370372

371373
// .......................................
372374
// LayoutTestController Functions
375+
@Override
373376
public void dumpAsText(boolean enablePixelTests) {
374377
// Added after webkit update to r63859. See trac.webkit.org/changeset/63730.
375378
if (enablePixelTests) {
@@ -384,6 +387,7 @@ public void dumpAsText(boolean enablePixelTests) {
384387
}
385388
}
386389

390+
@Override
387391
public void dumpChildFramesAsText() {
388392
mDumpDataType = DumpDataType.DUMP_AS_TEXT;
389393
mDumpChildFramesAsText = true;
@@ -393,12 +397,14 @@ public void dumpChildFramesAsText() {
393397
}
394398
}
395399

400+
@Override
396401
public void waitUntilDone() {
397402
mWaitUntilDone = true;
398403
String url = mWebView.getUrl();
399404
Log.v(LOGTAG, "waitUntilDone called: " + url);
400405
}
401406

407+
@Override
402408
public void notifyDone() {
403409
String url = mWebView.getUrl();
404410
Log.v(LOGTAG, "notifyDone called: " + url);
@@ -410,104 +416,124 @@ public void notifyDone() {
410416
}
411417
}
412418

419+
@Override
413420
public void display() {
414421
mWebView.invalidate();
415422
}
416423

424+
@Override
417425
public void clearBackForwardList() {
418426
mWebView.clearHistory();
419427

420428
}
421429

430+
@Override
422431
public void dumpBackForwardList() {
423432
//printf("\n============== Back Forward List ==============\n");
424433
// mWebHistory
425434
//printf("===============================================\n");
426435

427436
}
428437

438+
@Override
429439
public void dumpChildFrameScrollPositions() {
430440
// TODO Auto-generated method stub
431441

432442
}
433443

444+
@Override
434445
public void dumpEditingCallbacks() {
435446
// TODO Auto-generated method stub
436447

437448
}
438449

450+
@Override
439451
public void dumpSelectionRect() {
440452
// TODO Auto-generated method stub
441453

442454
}
443455

456+
@Override
444457
public void dumpTitleChanges() {
445458
if (!mDumpTitleChanges) {
446459
mTitleChanges = new StringBuffer();
447460
}
448461
mDumpTitleChanges = true;
449462
}
450463

464+
@Override
451465
public void keepWebHistory() {
452466
if (!mKeepWebHistory) {
453467
mWebHistory = new Vector();
454468
}
455469
mKeepWebHistory = true;
456470
}
457471

472+
@Override
458473
public void queueBackNavigation(int howfar) {
459474
// TODO Auto-generated method stub
460475

461476
}
462477

478+
@Override
463479
public void queueForwardNavigation(int howfar) {
464480
// TODO Auto-generated method stub
465481

466482
}
467483

484+
@Override
468485
public void queueLoad(String Url, String frameTarget) {
469486
// TODO Auto-generated method stub
470487

471488
}
472489

490+
@Override
473491
public void queueReload() {
474492
mWebView.reload();
475493
}
476494

495+
@Override
477496
public void queueScript(String scriptToRunInCurrentContext) {
478497
mWebView.loadUrl("javascript:"+scriptToRunInCurrentContext);
479498
}
480499

500+
@Override
481501
public void repaintSweepHorizontally() {
482502
// TODO Auto-generated method stub
483503

484504
}
485505

506+
@Override
486507
public void setAcceptsEditing(boolean b) {
487508
// TODO Auto-generated method stub
488509

489510
}
490511

512+
@Override
491513
public void setMainFrameIsFirstResponder(boolean b) {
492514
// TODO Auto-generated method stub
493515

494516
}
495517

518+
@Override
496519
public void setWindowIsKey(boolean b) {
497520
// This is meant to show/hide the window. The best I can find
498521
// is setEnabled()
499522
mWebView.setEnabled(b);
500523
}
501524

525+
@Override
502526
public void testRepaint() {
503527
mWebView.invalidate();
504528
}
505529

530+
@Override
506531
public void dumpDatabaseCallbacks() {
507532
Log.v(LOGTAG, "dumpDatabaseCallbacks called.");
508533
mDumpDatabaseCallbacks = true;
509534
}
510535

536+
@Override
511537
public void setCanOpenWindows() {
512538
Log.v(LOGTAG, "setCanOpenWindows called.");
513539
mCanOpenWindows = true;
@@ -516,6 +542,7 @@ public void setCanOpenWindows() {
516542
/**
517543
* Sets the Geolocation permission state to be used for all future requests.
518544
*/
545+
@Override
519546
public void setGeolocationPermission(boolean allow) {
520547
mIsGeolocationPermissionSet = true;
521548
mGeolocationPermission = allow;
@@ -532,12 +559,14 @@ public void setGeolocationPermission(boolean allow) {
532559
}
533560
}
534561

562+
@Override
535563
public void setMockDeviceOrientation(boolean canProvideAlpha, double alpha,
536564
boolean canProvideBeta, double beta, boolean canProvideGamma, double gamma) {
537565
WebViewClassic.fromWebView(mWebView).setMockDeviceOrientation(canProvideAlpha, alpha,
538566
canProvideBeta, beta, canProvideGamma, gamma);
539567
}
540568

569+
@Override
541570
public void overridePreference(String key, boolean value) {
542571
// TODO: We should look up the correct WebView for the frame which
543572
// called the layoutTestController method. Currently, we just use the
@@ -554,6 +583,7 @@ public void overridePreference(String key, boolean value) {
554583
}
555584
}
556585

586+
@Override
557587
public void setXSSAuditorEnabled (boolean flag) {
558588
mWebViewClassic.getSettings().setXSSAuditorEnabled(flag);
559589
}
@@ -754,6 +784,7 @@ public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
754784
&& mWaitUntilDone && mStopOnRefError) {
755785
Log.w(LOGTAG, "Terminating test case on uncaught ReferenceError or TypeError.");
756786
mHandler.postDelayed(new Runnable() {
787+
@Override
757788
public void run() {
758789
notifyDone();
759790
}
@@ -860,6 +891,8 @@ public void setDefaultWebSettings(WebView webview) {
860891
settings.setXSSAuditorEnabled(false);
861892
settings.setPageCacheCapacity(0);
862893
settings.setProperty("use_minimal_memory", "false");
894+
settings.setAllowUniversalAccessFromFileURLs(true);
895+
settings.setAllowFileAccessFromFileURLs(true);
863896
}
864897

865898
private WebViewClassic mWebViewClassic;

0 commit comments

Comments
 (0)