@Override public boolean isPrivateBrowsingEnabled() { if (Build.VERSION.SDK_INT == Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1 && getSettings() == null) { return false; // getSettings().isPrivateBrowsingEnabled() } else { return super.isPrivateBrowsingEnabled(); } }
@TargetApi(HONEYCOMB) public WebViewAssert isPrivateBrowsingEnabled() { isNotNull(); assertThat(actual.isPrivateBrowsingEnabled()) // .overridingErrorMessage("Expected private browsing to be enabled but was disabled.") // .isTrue(); return this; }
@TargetApi(HONEYCOMB) public WebViewAssert isPrivateBrowsingDisabled() { isNotNull(); assertThat(actual.isPrivateBrowsingEnabled()) // .overridingErrorMessage("Expected private browsing to be disabled but was enabled.") // .isFalse(); return this; } }
WebView webView = new WebView(this, null, R.id.webView1, true); webView.getSettings().setJavaScriptEnabled(true); webView.loadUrl("google.com"); Log.v("PrivateBrowsing", "" + webView.isPrivateBrowsingEnabled()); << returns true for me
@TargetApi(HONEYCOMB) public WebViewAssert isPrivateBrowsingEnabled() { isNotNull(); assertThat(actual.isPrivateBrowsingEnabled()) // .overridingErrorMessage("Expected private browsing to be enabled but was disabled.") // .isTrue(); return this; }
@TargetApi(HONEYCOMB) public WebViewAssert isPrivateBrowsingDisabled() { isNotNull(); assertThat(actual.isPrivateBrowsingEnabled()) // .overridingErrorMessage("Expected private browsing to be disabled but was enabled.") // .isFalse(); return this; } }
@Override public void run() { data.put("CanGoBack", wv.canGoBack()); data.put("CanGoForward", wv.canGoForward()); data.put("OriginalURL", wv.getOriginalUrl()); data.put("URL", wv.getUrl()); data.put("Title", wv.getTitle()); data.put("Progress", wv.getProgress()); WebSettings settings = wv.getSettings(); fillSettings(settings, data); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { data.put("CanZoomIn", wv.canZoomIn()); data.put("CanZoomOut", wv.canZoomOut()); data.put("IsPrivateBrowsingEnabled", wv.isPrivateBrowsingEnabled()); } synchronized (lock) { lock.notifyAll(); } } });