Commit c00af75b authored by aurimas@chromium.org's avatar aurimas@chromium.org

[Checkstyle] Update class member variable names to match style guides.

- Non-public, non-static field names start with m.
http://source.android.com/source/code-style.html#follow-field-naming-conventions

BUG=318404

Review URL: https://codereview.chromium.org/452613002

Cr-Commit-Position: refs/heads/master@{#288299}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288299 0039d316-1c4b-4281-b951-d872f2087c98
parent d0911fd9
...@@ -207,7 +207,7 @@ public class AwContentsClientBridge { ...@@ -207,7 +207,7 @@ public class AwContentsClientBridge {
} }
if (cert != null) { if (cert != null) {
nativeProvideClientCertificateResponse(mNativeContentsClientBridge, id, nativeProvideClientCertificateResponse(mNativeContentsClientBridge, id,
cert.certChain, cert.privateKey); cert.mCertChain, cert.mPrivateKey);
return; return;
} }
// Build the list of principals from encoded versions. // Build the list of principals from encoded versions.
......
...@@ -171,13 +171,13 @@ class AwWebContentsDelegateAdapter extends AwWebContentsDelegate { ...@@ -171,13 +171,13 @@ class AwWebContentsDelegateAdapter extends AwWebContentsDelegate {
params.capture = capture; params.capture = capture;
mContentsClient.showFileChooser(new ValueCallback<String[]>() { mContentsClient.showFileChooser(new ValueCallback<String[]>() {
boolean completed = false; boolean mCompleted = false;
@Override @Override
public void onReceiveValue(String[] results) { public void onReceiveValue(String[] results) {
if (completed) { if (mCompleted) {
throw new IllegalStateException("Duplicate showFileChooser result"); throw new IllegalStateException("Duplicate showFileChooser result");
} }
completed = true; mCompleted = true;
nativeFilesSelectedInChooser(processId, renderId, mode_flags, results); nativeFilesSelectedInChooser(processId, renderId, mode_flags, results);
} }
}, params); }, params);
......
...@@ -22,17 +22,17 @@ public class ClientCertLookupTable { ...@@ -22,17 +22,17 @@ public class ClientCertLookupTable {
* A container for the certificate data. * A container for the certificate data.
*/ */
public static class Cert { public static class Cert {
AndroidPrivateKey privateKey; AndroidPrivateKey mPrivateKey;
byte[][] certChain; byte[][] mCertChain;
public Cert(AndroidPrivateKey privateKey, byte[][] certChain) { public Cert(AndroidPrivateKey privateKey, byte[][] certChain) {
this.privateKey = privateKey; this.mPrivateKey = privateKey;
byte[][] newChain = new byte[certChain.length][]; byte[][] newChain = new byte[certChain.length][];
for (int i = 0; i < certChain.length; i++) { for (int i = 0; i < certChain.length; i++) {
newChain[i] = Arrays.copyOf(certChain[i], certChain[i].length); newChain[i] = Arrays.copyOf(certChain[i], certChain[i].length);
} }
this.certChain = newChain; this.mCertChain = newChain;
} }
}; }
private final Map<String, Cert> mCerts; private final Map<String, Cert> mCerts;
private final Set<String> mDenieds; private final Set<String> mDenieds;
......
...@@ -23,7 +23,7 @@ import java.util.concurrent.atomic.AtomicReference; ...@@ -23,7 +23,7 @@ import java.util.concurrent.atomic.AtomicReference;
* Tests for certain edge cases related to integrating with the Android view system. * Tests for certain edge cases related to integrating with the Android view system.
*/ */
public class AndroidViewIntegrationTest extends AwTestBase { public class AndroidViewIntegrationTest extends AwTestBase {
final int CONTENT_SIZE_CHANGE_STABILITY_TIMEOUT_MS = 1000; private static final int CONTENT_SIZE_CHANGE_STABILITY_TIMEOUT_MS = 1000;
private static class OnContentSizeChangedHelper extends CallbackHelper { private static class OnContentSizeChangedHelper extends CallbackHelper {
private int mWidth; private int mWidth;
...@@ -76,7 +76,7 @@ public class AndroidViewIntegrationTest extends AwTestBase { ...@@ -76,7 +76,7 @@ public class AndroidViewIntegrationTest extends AwTestBase {
}; };
} }
final LinearLayout.LayoutParams wrapContentLayoutParams = final LinearLayout.LayoutParams mWrapContentLayoutParams =
new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
private AwTestContainerView createCustomTestContainerViewOnMainSync( private AwTestContainerView createCustomTestContainerViewOnMainSync(
...@@ -87,7 +87,7 @@ public class AndroidViewIntegrationTest extends AwTestBase { ...@@ -87,7 +87,7 @@ public class AndroidViewIntegrationTest extends AwTestBase {
@Override @Override
public void run() { public void run() {
testContainerView.set(createAwTestContainerView(awContentsClient)); testContainerView.set(createAwTestContainerView(awContentsClient));
testContainerView.get().setLayoutParams(wrapContentLayoutParams); testContainerView.get().setLayoutParams(mWrapContentLayoutParams);
testContainerView.get().setVisibility(visibility); testContainerView.get().setVisibility(visibility);
} }
}); });
......
...@@ -24,25 +24,25 @@ import org.chromium.content.common.ContentSwitches; ...@@ -24,25 +24,25 @@ import org.chromium.content.common.ContentSwitches;
public class AwContentsClientFullScreenVideoTest extends AwTestBase { public class AwContentsClientFullScreenVideoTest extends AwTestBase {
private FullScreenVideoTestAwContentsClient mContentsClient; private FullScreenVideoTestAwContentsClient mContentsClient;
private ContentViewCore mContentViewCore; private ContentViewCore mContentViewCore;
private VideoTestWebServer webServer; private VideoTestWebServer mWebServer;
private AwTestContainerView testContainerView; private AwTestContainerView mTestContainerView;
@Override @Override
protected void setUp() throws Exception { protected void setUp() throws Exception {
super.setUp(); super.setUp();
mContentsClient = new FullScreenVideoTestAwContentsClient(getActivity()); mContentsClient = new FullScreenVideoTestAwContentsClient(getActivity());
testContainerView = mTestContainerView =
createAwTestContainerViewOnMainSync(mContentsClient); createAwTestContainerViewOnMainSync(mContentsClient);
mContentViewCore = testContainerView.getContentViewCore(); mContentViewCore = mTestContainerView.getContentViewCore();
enableJavaScriptOnUiThread(testContainerView.getAwContents()); enableJavaScriptOnUiThread(mTestContainerView.getAwContents());
webServer = new VideoTestWebServer( mWebServer = new VideoTestWebServer(
getInstrumentation().getTargetContext()); getInstrumentation().getTargetContext());
} }
@Override @Override
protected void tearDown() throws Exception { protected void tearDown() throws Exception {
super.tearDown(); super.tearDown();
if (webServer != null) webServer.getTestWebServer().shutdown(); if (mWebServer != null) mWebServer.getTestWebServer().shutdown();
} }
@MediumTest @MediumTest
...@@ -122,13 +122,13 @@ public class AwContentsClientFullScreenVideoTest extends AwTestBase { ...@@ -122,13 +122,13 @@ public class AwContentsClientFullScreenVideoTest extends AwTestBase {
} }
private void doOnShowCustomViewTest() throws Exception { private void doOnShowCustomViewTest() throws Exception {
loadUrlSync(testContainerView.getAwContents(), loadUrlSync(mTestContainerView.getAwContents(),
mContentsClient.getOnPageFinishedHelper(), mContentsClient.getOnPageFinishedHelper(),
webServer.getFullScreenVideoTestURL()); mWebServer.getFullScreenVideoTestURL());
// Click the button in full_screen_video_test.html to enter fullscreen. // Click the button in full_screen_video_test.html to enter fullscreen.
TouchCommon touchCommon = new TouchCommon(this); TouchCommon touchCommon = new TouchCommon(this);
touchCommon.singleClickView(testContainerView); touchCommon.singleClickView(mTestContainerView);
mContentsClient.waitForCustomViewShown(); mContentsClient.waitForCustomViewShown();
} }
} }
...@@ -117,8 +117,8 @@ public class AwContentsClientShouldInterceptRequestTest extends AwTestBase { ...@@ -117,8 +117,8 @@ public class AwContentsClientShouldInterceptRequestTest extends AwTestBase {
} }
} }
final int teapotStatusCode = 418; private static final int TEAPOT_STATUS_CODE = 418;
final String teapotResponsePhrase = "I'm a teapot"; private static final String TEAPOD_RESPONSE_PHRASE = "I'm a teapot";
private String addPageToTestServer(TestWebServer webServer, String httpPath, String html) { private String addPageToTestServer(TestWebServer webServer, String httpPath, String html) {
List<Pair<String, String>> headers = new ArrayList<Pair<String, String>>(); List<Pair<String, String>> headers = new ArrayList<Pair<String, String>>();
...@@ -492,8 +492,8 @@ public class AwContentsClientShouldInterceptRequestTest extends AwTestBase { ...@@ -492,8 +492,8 @@ public class AwContentsClientShouldInterceptRequestTest extends AwTestBase {
mShouldInterceptRequestHelper.setReturnValue( mShouldInterceptRequestHelper.setReturnValue(
new AwWebResourceResponse("text/html", "UTF-8", new EmptyInputStream(), new AwWebResourceResponse("text/html", "UTF-8", new EmptyInputStream(),
teapotStatusCode, teapotResponsePhrase, new HashMap<String, String>())); TEAPOT_STATUS_CODE, TEAPOD_RESPONSE_PHRASE, new HashMap<String, String>()));
assertEquals("\"[" + teapotStatusCode + "][" + teapotResponsePhrase + "]\"", assertEquals("\"[" + TEAPOT_STATUS_CODE + "][" + TEAPOD_RESPONSE_PHRASE + "]\"",
executeJavaScriptAndWaitForResult(mAwContents, mContentsClient, syncGetJs)); executeJavaScriptAndWaitForResult(mAwContents, mContentsClient, syncGetJs));
} }
......
...@@ -24,7 +24,7 @@ import java.util.concurrent.Callable; ...@@ -24,7 +24,7 @@ import java.util.concurrent.Callable;
public class AwZoomTest extends AwTestBase { public class AwZoomTest extends AwTestBase {
private TestAwContentsClient mContentsClient; private TestAwContentsClient mContentsClient;
private AwContents mAwContents; private AwContents mAwContents;
private float MAXIMUM_SCALE = 2.0f; private static float MAXIMUM_SCALE = 2.0f;
@Override @Override
public void setUp() throws Exception { public void setUp() throws Exception {
......
...@@ -52,36 +52,36 @@ public class ClientOnPageFinishedTest extends AwTestBase { ...@@ -52,36 +52,36 @@ public class ClientOnPageFinishedTest extends AwTestBase {
@Feature({"AndroidWebView"}) @Feature({"AndroidWebView"})
public void testOnPageFinishedCalledAfterError() throws Throwable { public void testOnPageFinishedCalledAfterError() throws Throwable {
class LocalTestClient extends TestAwContentsClient { class LocalTestClient extends TestAwContentsClient {
private boolean isOnReceivedErrorCalled = false; private boolean mIsOnReceivedErrorCalled = false;
private boolean isOnPageFinishedCalled = false; private boolean mIsOnPageFinishedCalled = false;
private boolean allowAboutBlank = false; private boolean mAllowAboutBlank = false;
@Override @Override
public void onReceivedError(int errorCode, String description, String failingUrl) { public void onReceivedError(int errorCode, String description, String failingUrl) {
assertEquals("onReceivedError called twice for " + failingUrl, assertEquals("onReceivedError called twice for " + failingUrl,
false, isOnReceivedErrorCalled); false, mIsOnReceivedErrorCalled);
isOnReceivedErrorCalled = true; mIsOnReceivedErrorCalled = true;
assertEquals("onPageFinished called before onReceivedError for " + failingUrl, assertEquals("onPageFinished called before onReceivedError for " + failingUrl,
false, isOnPageFinishedCalled); false, mIsOnPageFinishedCalled);
super.onReceivedError(errorCode, description, failingUrl); super.onReceivedError(errorCode, description, failingUrl);
} }
@Override @Override
public void onPageFinished(String url) { public void onPageFinished(String url) {
if (allowAboutBlank && "about:blank".equals(url)) { if (mAllowAboutBlank && "about:blank".equals(url)) {
super.onPageFinished(url); super.onPageFinished(url);
return; return;
} }
assertEquals("onPageFinished called twice for " + url, assertEquals("onPageFinished called twice for " + url,
false, isOnPageFinishedCalled); false, mIsOnPageFinishedCalled);
isOnPageFinishedCalled = true; mIsOnPageFinishedCalled = true;
assertEquals("onReceivedError not called before onPageFinished for " + url, assertEquals("onReceivedError not called before onPageFinished for " + url,
true, isOnReceivedErrorCalled); true, mIsOnReceivedErrorCalled);
super.onPageFinished(url); super.onPageFinished(url);
} }
void setAllowAboutBlank() { void setAllowAboutBlank() {
allowAboutBlank = true; mAllowAboutBlank = true;
} }
}; };
LocalTestClient testContentsClient = new LocalTestClient(); LocalTestClient testContentsClient = new LocalTestClient();
......
...@@ -49,38 +49,39 @@ public class ClientOnPageStartedTest extends AwTestBase { ...@@ -49,38 +49,39 @@ public class ClientOnPageStartedTest extends AwTestBase {
@Feature({"AndroidWebView"}) @Feature({"AndroidWebView"})
public void testOnPageStartedCalledOnceOnError() throws Throwable { public void testOnPageStartedCalledOnceOnError() throws Throwable {
class LocalTestClient extends TestAwContentsClient { class LocalTestClient extends TestAwContentsClient {
private boolean isOnReceivedErrorCalled = false; private boolean mIsOnReceivedErrorCalled = false;
private boolean isOnPageStartedCalled = false; private boolean mIsOnPageStartedCalled = false;
private boolean allowAboutBlank = false; private boolean mAllowAboutBlank = false;
@Override @Override
public void onReceivedError(int errorCode, String description, String failingUrl) { public void onReceivedError(int errorCode, String description, String failingUrl) {
assertEquals("onReceivedError called twice for " + failingUrl, assertEquals("onReceivedError called twice for " + failingUrl,
false, isOnReceivedErrorCalled); false, mIsOnReceivedErrorCalled);
isOnReceivedErrorCalled = true; mIsOnReceivedErrorCalled = true;
assertEquals("onPageStarted not called before onReceivedError for " + failingUrl, assertEquals("onPageStarted not called before onReceivedError for " + failingUrl,
true, isOnPageStartedCalled); true, mIsOnPageStartedCalled);
super.onReceivedError(errorCode, description, failingUrl); super.onReceivedError(errorCode, description, failingUrl);
} }
@Override @Override
public void onPageStarted(String url) { public void onPageStarted(String url) {
if (allowAboutBlank && "about:blank".equals(url)) { if (mAllowAboutBlank && "about:blank".equals(url)) {
super.onPageStarted(url); super.onPageStarted(url);
return; return;
} }
assertEquals("onPageStarted called twice for " + url, assertEquals("onPageStarted called twice for " + url,
false, isOnPageStartedCalled); false, mIsOnPageStartedCalled);
isOnPageStartedCalled = true; mIsOnPageStartedCalled = true;
assertEquals("onReceivedError called before onPageStarted for " + url, assertEquals("onReceivedError called before onPageStarted for " + url,
false, isOnReceivedErrorCalled); false, mIsOnReceivedErrorCalled);
super.onPageStarted(url); super.onPageStarted(url);
} }
void setAllowAboutBlank() { void setAllowAboutBlank() {
allowAboutBlank = true; mAllowAboutBlank = true;
} }
}; }
LocalTestClient testContentsClient = new LocalTestClient(); LocalTestClient testContentsClient = new LocalTestClient();
setTestAwContentsClient(testContentsClient); setTestAwContentsClient(testContentsClient);
......
...@@ -51,12 +51,12 @@ class InputStreamUnittest { ...@@ -51,12 +51,12 @@ class InputStreamUnittest {
@CalledByNative @CalledByNative
static InputStream getCountingStream(final int size) { static InputStream getCountingStream(final int size) {
return new InputStream() { return new InputStream() {
private int count = 0; private int mCount = 0;
@Override @Override
public int read() { public int read() {
if (count < size) if (mCount < size)
return count++ % 256; return mCount++ % 256;
else else
return -1; return -1;
} }
......
...@@ -1003,12 +1003,12 @@ public class ChromeBrowserProvider extends ContentProvider { ...@@ -1003,12 +1003,12 @@ public class ChromeBrowserProvider extends ContentProvider {
private long addBookmarkFromAPI(ContentValues values) { private long addBookmarkFromAPI(ContentValues values) {
BookmarkRow row = BookmarkRow.fromContentValues(values); BookmarkRow row = BookmarkRow.fromContentValues(values);
if (row.url == null) { if (row.mUrl == null) {
throw new IllegalArgumentException("Must have a bookmark URL"); throw new IllegalArgumentException("Must have a bookmark URL");
} }
return nativeAddBookmarkFromAPI(mNativeChromeBrowserProvider, return nativeAddBookmarkFromAPI(mNativeChromeBrowserProvider,
row.url, row.created, row.isBookmark, row.date, row.favicon, row.mUrl, row.mCreated, row.mIsBookmark, row.mDate, row.mFavicon,
row.title, row.visits, row.parentId); row.mTitle, row.mVisits, row.mParentId);
} }
private Cursor queryBookmarkFromAPI(String[] projectionIn, String selection, private Cursor queryBookmarkFromAPI(String[] projectionIn, String selection,
...@@ -1028,8 +1028,8 @@ public class ChromeBrowserProvider extends ContentProvider { ...@@ -1028,8 +1028,8 @@ public class ChromeBrowserProvider extends ContentProvider {
String[] selectionArgs) { String[] selectionArgs) {
BookmarkRow row = BookmarkRow.fromContentValues(values); BookmarkRow row = BookmarkRow.fromContentValues(values);
return nativeUpdateBookmarkFromAPI(mNativeChromeBrowserProvider, return nativeUpdateBookmarkFromAPI(mNativeChromeBrowserProvider,
row.url, row.created, row.isBookmark, row.date, row.mUrl, row.mCreated, row.mIsBookmark, row.mDate,
row.favicon, row.title, row.visits, row.parentId, selection, selectionArgs); row.mFavicon, row.mTitle, row.mVisits, row.mParentId, selection, selectionArgs);
} }
private int removeBookmarkFromAPI(String selection, String[] selectionArgs) { private int removeBookmarkFromAPI(String selection, String[] selectionArgs) {
...@@ -1052,17 +1052,17 @@ public class ChromeBrowserProvider extends ContentProvider { ...@@ -1052,17 +1052,17 @@ public class ChromeBrowserProvider extends ContentProvider {
private long addSearchTermFromAPI(ContentValues values) { private long addSearchTermFromAPI(ContentValues values) {
SearchRow row = SearchRow.fromContentValues(values); SearchRow row = SearchRow.fromContentValues(values);
if (row.term == null) { if (row.mTerm == null) {
throw new IllegalArgumentException("Must have a search term"); throw new IllegalArgumentException("Must have a search term");
} }
return nativeAddSearchTermFromAPI(mNativeChromeBrowserProvider, row.term, row.date); return nativeAddSearchTermFromAPI(mNativeChromeBrowserProvider, row.mTerm, row.mDate);
} }
private int updateSearchTermFromAPI(ContentValues values, String selection, private int updateSearchTermFromAPI(ContentValues values, String selection,
String[] selectionArgs) { String[] selectionArgs) {
SearchRow row = SearchRow.fromContentValues(values); SearchRow row = SearchRow.fromContentValues(values);
return nativeUpdateSearchTermFromAPI(mNativeChromeBrowserProvider, return nativeUpdateSearchTermFromAPI(mNativeChromeBrowserProvider,
row.term, row.date, selection, selectionArgs); row.mTerm, row.mDate, selection, selectionArgs);
} }
private Cursor querySearchTermFromAPI(String[] projectionIn, String selection, private Cursor querySearchTermFromAPI(String[] projectionIn, String selection,
...@@ -1147,44 +1147,44 @@ public class ChromeBrowserProvider extends ContentProvider { ...@@ -1147,44 +1147,44 @@ public class ChromeBrowserProvider extends ContentProvider {
// Wrap the value of BookmarkColumn. // Wrap the value of BookmarkColumn.
private static class BookmarkRow { private static class BookmarkRow {
Boolean isBookmark; Boolean mIsBookmark;
Long created; Long mCreated;
String url; String mUrl;
Long date; Long mDate;
byte[] favicon; byte[] mFavicon;
String title; String mTitle;
Integer visits; Integer mVisits;
long parentId; long mParentId;
static BookmarkRow fromContentValues(ContentValues values) { static BookmarkRow fromContentValues(ContentValues values) {
BookmarkRow row = new BookmarkRow(); BookmarkRow row = new BookmarkRow();
if (values.containsKey(BookmarkColumns.URL)) { if (values.containsKey(BookmarkColumns.URL)) {
row.url = values.getAsString(BookmarkColumns.URL); row.mUrl = values.getAsString(BookmarkColumns.URL);
} }
if (values.containsKey(BookmarkColumns.BOOKMARK)) { if (values.containsKey(BookmarkColumns.BOOKMARK)) {
row.isBookmark = values.getAsInteger(BookmarkColumns.BOOKMARK) != 0; row.mIsBookmark = values.getAsInteger(BookmarkColumns.BOOKMARK) != 0;
} }
if (values.containsKey(BookmarkColumns.CREATED)) { if (values.containsKey(BookmarkColumns.CREATED)) {
row.created = values.getAsLong(BookmarkColumns.CREATED); row.mCreated = values.getAsLong(BookmarkColumns.CREATED);
} }
if (values.containsKey(BookmarkColumns.DATE)) { if (values.containsKey(BookmarkColumns.DATE)) {
row.date = values.getAsLong(BookmarkColumns.DATE); row.mDate = values.getAsLong(BookmarkColumns.DATE);
} }
if (values.containsKey(BookmarkColumns.FAVICON)) { if (values.containsKey(BookmarkColumns.FAVICON)) {
row.favicon = values.getAsByteArray(BookmarkColumns.FAVICON); row.mFavicon = values.getAsByteArray(BookmarkColumns.FAVICON);
// We need to know that the caller set the favicon column. // We need to know that the caller set the favicon column.
if (row.favicon == null) { if (row.mFavicon == null) {
row.favicon = new byte[0]; row.mFavicon = new byte[0];
} }
} }
if (values.containsKey(BookmarkColumns.TITLE)) { if (values.containsKey(BookmarkColumns.TITLE)) {
row.title = values.getAsString(BookmarkColumns.TITLE); row.mTitle = values.getAsString(BookmarkColumns.TITLE);
} }
if (values.containsKey(BookmarkColumns.VISITS)) { if (values.containsKey(BookmarkColumns.VISITS)) {
row.visits = values.getAsInteger(BookmarkColumns.VISITS); row.mVisits = values.getAsInteger(BookmarkColumns.VISITS);
} }
if (values.containsKey(BOOKMARK_PARENT_ID_PARAM)) { if (values.containsKey(BOOKMARK_PARENT_ID_PARAM)) {
row.parentId = values.getAsLong(BOOKMARK_PARENT_ID_PARAM); row.mParentId = values.getAsLong(BOOKMARK_PARENT_ID_PARAM);
} }
return row; return row;
} }
...@@ -1192,16 +1192,16 @@ public class ChromeBrowserProvider extends ContentProvider { ...@@ -1192,16 +1192,16 @@ public class ChromeBrowserProvider extends ContentProvider {
// Wrap the value of SearchColumn. // Wrap the value of SearchColumn.
private static class SearchRow { private static class SearchRow {
String term; String mTerm;
Long date; Long mDate;
static SearchRow fromContentValues(ContentValues values) { static SearchRow fromContentValues(ContentValues values) {
SearchRow row = new SearchRow(); SearchRow row = new SearchRow();
if (values.containsKey(SearchColumns.SEARCH)) { if (values.containsKey(SearchColumns.SEARCH)) {
row.term = values.getAsString(SearchColumns.SEARCH); row.mTerm = values.getAsString(SearchColumns.SEARCH);
} }
if (values.containsKey(SearchColumns.DATE)) { if (values.containsKey(SearchColumns.DATE)) {
row.date = values.getAsLong(SearchColumns.DATE); row.mDate = values.getAsLong(SearchColumns.DATE);
} }
return row; return row;
} }
......
...@@ -20,7 +20,7 @@ import org.chromium.chrome.browser.search_engines.TemplateUrlService; ...@@ -20,7 +20,7 @@ import org.chromium.chrome.browser.search_engines.TemplateUrlService;
public class ChromeContextMenuPopulator implements ContextMenuPopulator { public class ChromeContextMenuPopulator implements ContextMenuPopulator {
private final ChromeContextMenuItemDelegate mDelegate; private final ChromeContextMenuItemDelegate mDelegate;
private MenuInflater mMenuInflater; private MenuInflater mMenuInflater;
private final String BLANK_URL = "about:blank"; private static final String BLANK_URL = "about:blank";
/** /**
* Builds a {@link ChromeContextMenuPopulator}. * Builds a {@link ChromeContextMenuPopulator}.
......
...@@ -40,13 +40,13 @@ public class ShortcutHelperTest extends ChromeShellTestBase { ...@@ -40,13 +40,13 @@ public class ShortcutHelperTest extends ChromeShellTestBase {
+ "<body>Not Webapp capable</body></html>"); + "<body>Not Webapp capable</body></html>");
private static class TestObserver implements ChromeShellApplicationObserver { private static class TestObserver implements ChromeShellApplicationObserver {
Intent firedIntent; Intent mFiredIntent;
@Override @Override
public boolean onSendBroadcast(Intent intent) { public boolean onSendBroadcast(Intent intent) {
if (intent.hasExtra(Intent.EXTRA_SHORTCUT_NAME)) { if (intent.hasExtra(Intent.EXTRA_SHORTCUT_NAME)) {
// Stop a shortcut from really being added. // Stop a shortcut from really being added.
firedIntent = intent; mFiredIntent = intent;
return false; return false;
} }
...@@ -54,7 +54,7 @@ public class ShortcutHelperTest extends ChromeShellTestBase { ...@@ -54,7 +54,7 @@ public class ShortcutHelperTest extends ChromeShellTestBase {
} }
public void reset() { public void reset() {
firedIntent = null; mFiredIntent = null;
} }
} }
...@@ -84,7 +84,7 @@ public class ShortcutHelperTest extends ChromeShellTestBase { ...@@ -84,7 +84,7 @@ public class ShortcutHelperTest extends ChromeShellTestBase {
public void testAddWebappShortcuts() throws InterruptedException { public void testAddWebappShortcuts() throws InterruptedException {
// Add a webapp shortcut and make sure the intent's parameters make sense. // Add a webapp shortcut and make sure the intent's parameters make sense.
addShortcutToURL(WEBAPP_HTML, ""); addShortcutToURL(WEBAPP_HTML, "");
Intent firedIntent = mTestObserver.firedIntent; Intent firedIntent = mTestObserver.mFiredIntent;
assertEquals(WEBAPP_TITLE, firedIntent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME)); assertEquals(WEBAPP_TITLE, firedIntent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME));
Intent launchIntent = firedIntent.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT); Intent launchIntent = firedIntent.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT);
...@@ -95,7 +95,7 @@ public class ShortcutHelperTest extends ChromeShellTestBase { ...@@ -95,7 +95,7 @@ public class ShortcutHelperTest extends ChromeShellTestBase {
// Add a second shortcut and make sure it matches the second webapp's parameters. // Add a second shortcut and make sure it matches the second webapp's parameters.
mTestObserver.reset(); mTestObserver.reset();
addShortcutToURL(SECOND_WEBAPP_HTML, ""); addShortcutToURL(SECOND_WEBAPP_HTML, "");
Intent newFiredIntent = mTestObserver.firedIntent; Intent newFiredIntent = mTestObserver.mFiredIntent;
assertEquals(SECOND_WEBAPP_TITLE, assertEquals(SECOND_WEBAPP_TITLE,
newFiredIntent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME)); newFiredIntent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME));
...@@ -115,7 +115,7 @@ public class ShortcutHelperTest extends ChromeShellTestBase { ...@@ -115,7 +115,7 @@ public class ShortcutHelperTest extends ChromeShellTestBase {
addShortcutToURL(NORMAL_HTML, ""); addShortcutToURL(NORMAL_HTML, "");
// Make sure the intent's parameters make sense. // Make sure the intent's parameters make sense.
Intent firedIntent = mTestObserver.firedIntent; Intent firedIntent = mTestObserver.mFiredIntent;
assertEquals(NORMAL_TITLE, firedIntent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME)); assertEquals(NORMAL_TITLE, firedIntent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME));
Intent launchIntent = firedIntent.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT); Intent launchIntent = firedIntent.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT);
...@@ -133,7 +133,7 @@ public class ShortcutHelperTest extends ChromeShellTestBase { ...@@ -133,7 +133,7 @@ public class ShortcutHelperTest extends ChromeShellTestBase {
public void testAddWebappShortcutsWithoutTitleEdit() throws InterruptedException { public void testAddWebappShortcutsWithoutTitleEdit() throws InterruptedException {
// Add a webapp shortcut to check unedited title. // Add a webapp shortcut to check unedited title.
addShortcutToURL(WEBAPP_HTML, ""); addShortcutToURL(WEBAPP_HTML, "");
Intent firedIntent = mTestObserver.firedIntent; Intent firedIntent = mTestObserver.mFiredIntent;
assertEquals(WEBAPP_TITLE, firedIntent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME)); assertEquals(WEBAPP_TITLE, firedIntent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME));
} }
...@@ -146,7 +146,7 @@ public class ShortcutHelperTest extends ChromeShellTestBase { ...@@ -146,7 +146,7 @@ public class ShortcutHelperTest extends ChromeShellTestBase {
public void testAddWebappShortcutsWithTitleEdit() throws InterruptedException { public void testAddWebappShortcutsWithTitleEdit() throws InterruptedException {
// Add a webapp shortcut to check edited title. // Add a webapp shortcut to check edited title.
addShortcutToURL(WEBAPP_HTML, EDITED_WEBAPP_TITLE); addShortcutToURL(WEBAPP_HTML, EDITED_WEBAPP_TITLE);
Intent firedIntent = mTestObserver.firedIntent; Intent firedIntent = mTestObserver.mFiredIntent;
assertEquals(EDITED_WEBAPP_TITLE , firedIntent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME)); assertEquals(EDITED_WEBAPP_TITLE , firedIntent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME));
} }
...@@ -167,7 +167,7 @@ public class ShortcutHelperTest extends ChromeShellTestBase { ...@@ -167,7 +167,7 @@ public class ShortcutHelperTest extends ChromeShellTestBase {
assertTrue(CriteriaHelper.pollForCriteria(new Criteria() { assertTrue(CriteriaHelper.pollForCriteria(new Criteria() {
@Override @Override
public boolean isSatisfied() { public boolean isSatisfied() {
return mTestObserver.firedIntent != null; return mTestObserver.mFiredIntent != null;
} }
})); }));
} }
......
...@@ -325,7 +325,7 @@ public class InvalidationControllerTest extends InstrumentationTestCase { ...@@ -325,7 +325,7 @@ public class InvalidationControllerTest extends InstrumentationTestCase {
* Mock context that saves all intents given to {@code startService}. * Mock context that saves all intents given to {@code startService}.
*/ */
private static class IntentSavingContext extends AdvancedMockContext { private static class IntentSavingContext extends AdvancedMockContext {
private final List<Intent> startedIntents = new ArrayList<Intent>(); private final List<Intent> mStartedIntents = new ArrayList<Intent>();
IntentSavingContext(Context targetContext) { IntentSavingContext(Context targetContext) {
super(targetContext); super(targetContext);
...@@ -333,16 +333,16 @@ public class InvalidationControllerTest extends InstrumentationTestCase { ...@@ -333,16 +333,16 @@ public class InvalidationControllerTest extends InstrumentationTestCase {
@Override @Override
public ComponentName startService(Intent intent) { public ComponentName startService(Intent intent) {
startedIntents.add(intent); mStartedIntents.add(intent);
return new ComponentName(this, getClass()); return new ComponentName(this, getClass());
} }
int getNumStartedIntents() { int getNumStartedIntents() {
return startedIntents.size(); return mStartedIntents.size();
} }
Intent getStartedIntent(int idx) { Intent getStartedIntent(int idx) {
return startedIntents.get(idx); return mStartedIntents.get(idx);
} }
@Override @Override
......
...@@ -34,7 +34,7 @@ import java.util.Map; ...@@ -34,7 +34,7 @@ import java.util.Map;
class MediaResourceGetter { class MediaResourceGetter {
private static final String TAG = "MediaResourceGetter"; private static final String TAG = "MediaResourceGetter";
private final MediaMetadata EMPTY_METADATA = new MediaMetadata(0,0,0,false); private static final MediaMetadata EMPTY_METADATA = new MediaMetadata(0,0,0,false);
private final MediaMetadataRetriever mRetriever = new MediaMetadataRetriever(); private final MediaMetadataRetriever mRetriever = new MediaMetadataRetriever();
......
...@@ -21,20 +21,20 @@ import org.chromium.content_shell_apk.ContentShellTestBase; ...@@ -21,20 +21,20 @@ import org.chromium.content_shell_apk.ContentShellTestBase;
*/ */
public class ContentViewCoreFocusTest extends ContentShellTestBase { public class ContentViewCoreFocusTest extends ContentShellTestBase {
private static class TestInputMethodManagerWrapper extends InputMethodManagerWrapper { private static class TestInputMethodManagerWrapper extends InputMethodManagerWrapper {
private boolean hidden = false; private boolean mHidden = false;
public TestInputMethodManagerWrapper(Context context) { public TestInputMethodManagerWrapper(Context context) {
super(context); super(context);
} }
@Override @Override
public void showSoftInput(View view, int flags, ResultReceiver resultReceiver) { public void showSoftInput(View view, int flags, ResultReceiver resultReceiver) {
hidden = false; mHidden = false;
} }
@Override @Override
public boolean hideSoftInputFromWindow(IBinder windowToken, int flags, public boolean hideSoftInputFromWindow(IBinder windowToken, int flags,
ResultReceiver resultReceiver) { ResultReceiver resultReceiver) {
hidden = true; mHidden = true;
return true; return true;
} }
...@@ -44,7 +44,7 @@ public class ContentViewCoreFocusTest extends ContentShellTestBase { ...@@ -44,7 +44,7 @@ public class ContentViewCoreFocusTest extends ContentShellTestBase {
} }
public boolean isHidden() { public boolean isHidden() {
return hidden; return mHidden;
} }
} }
......
...@@ -44,8 +44,8 @@ public class DeviceSensorsTest extends AndroidTestCase { ...@@ -44,8 +44,8 @@ public class DeviceSensorsTest extends AndroidTestCase {
assertFalse(mDeviceSensors.mDeviceOrientationIsActive); assertFalse(mDeviceSensors.mDeviceOrientationIsActive);
assertEquals(DeviceSensors.DEVICE_MOTION_SENSORS.size(), assertEquals(DeviceSensors.DEVICE_MOTION_SENSORS.size(),
mMockSensorManager.numRegistered); mMockSensorManager.mNumRegistered);
assertEquals(0, mMockSensorManager.numUnRegistered); assertEquals(0, mMockSensorManager.mNumUnRegistered);
assertEquals(DeviceSensors.DEVICE_MOTION_SENSORS.size(), assertEquals(DeviceSensors.DEVICE_MOTION_SENSORS.size(),
mDeviceSensors.getNumberActiveDeviceMotionSensors()); mDeviceSensors.getNumberActiveDeviceMotionSensors());
} }
...@@ -63,8 +63,8 @@ public class DeviceSensorsTest extends AndroidTestCase { ...@@ -63,8 +63,8 @@ public class DeviceSensorsTest extends AndroidTestCase {
assertTrue(mDeviceSensors.mDeviceOrientationIsActive); assertTrue(mDeviceSensors.mDeviceOrientationIsActive);
assertEquals(DeviceSensors.DEVICE_ORIENTATION_SENSORS.size(), assertEquals(DeviceSensors.DEVICE_ORIENTATION_SENSORS.size(),
mMockSensorManager.numRegistered); mMockSensorManager.mNumRegistered);
assertEquals(0, mMockSensorManager.numUnRegistered); assertEquals(0, mMockSensorManager.mNumUnRegistered);
} }
@SmallTest @SmallTest
...@@ -90,8 +90,8 @@ public class DeviceSensorsTest extends AndroidTestCase { ...@@ -90,8 +90,8 @@ public class DeviceSensorsTest extends AndroidTestCase {
assertEquals(union.size(), mDeviceSensors.mActiveSensors.size()); assertEquals(union.size(), mDeviceSensors.mActiveSensors.size());
assertTrue(mDeviceSensors.mDeviceMotionIsActive); assertTrue(mDeviceSensors.mDeviceMotionIsActive);
assertTrue(mDeviceSensors.mDeviceOrientationIsActive); assertTrue(mDeviceSensors.mDeviceOrientationIsActive);
assertEquals(union.size(), mMockSensorManager.numRegistered); assertEquals(union.size(), mMockSensorManager.mNumRegistered);
assertEquals(0, mMockSensorManager.numUnRegistered); assertEquals(0, mMockSensorManager.mNumUnRegistered);
assertEquals(DeviceSensors.DEVICE_MOTION_SENSORS.size(), assertEquals(DeviceSensors.DEVICE_MOTION_SENSORS.size(),
mDeviceSensors.getNumberActiveDeviceMotionSensors()); mDeviceSensors.getNumberActiveDeviceMotionSensors());
} }
...@@ -106,7 +106,7 @@ public class DeviceSensorsTest extends AndroidTestCase { ...@@ -106,7 +106,7 @@ public class DeviceSensorsTest extends AndroidTestCase {
assertFalse(mDeviceSensors.mDeviceMotionIsActive); assertFalse(mDeviceSensors.mDeviceMotionIsActive);
assertFalse(mDeviceSensors.mDeviceOrientationIsActive); assertFalse(mDeviceSensors.mDeviceOrientationIsActive);
assertEquals(DeviceSensors.DEVICE_MOTION_SENSORS.size(), assertEquals(DeviceSensors.DEVICE_MOTION_SENSORS.size(),
mMockSensorManager.numUnRegistered); mMockSensorManager.mNumUnRegistered);
assertEquals(0, mDeviceSensors.getNumberActiveDeviceMotionSensors()); assertEquals(0, mDeviceSensors.getNumberActiveDeviceMotionSensors());
} }
...@@ -120,7 +120,7 @@ public class DeviceSensorsTest extends AndroidTestCase { ...@@ -120,7 +120,7 @@ public class DeviceSensorsTest extends AndroidTestCase {
assertFalse(mDeviceSensors.mDeviceMotionIsActive); assertFalse(mDeviceSensors.mDeviceMotionIsActive);
assertFalse(mDeviceSensors.mDeviceOrientationIsActive); assertFalse(mDeviceSensors.mDeviceOrientationIsActive);
assertEquals(DeviceSensors.DEVICE_ORIENTATION_SENSORS.size(), assertEquals(DeviceSensors.DEVICE_ORIENTATION_SENSORS.size(),
mMockSensorManager.numUnRegistered); mMockSensorManager.mNumUnRegistered);
} }
@SmallTest @SmallTest
...@@ -136,14 +136,14 @@ public class DeviceSensorsTest extends AndroidTestCase { ...@@ -136,14 +136,14 @@ public class DeviceSensorsTest extends AndroidTestCase {
Set<Integer> diff = new HashSet<Integer>(DeviceSensors.DEVICE_MOTION_SENSORS); Set<Integer> diff = new HashSet<Integer>(DeviceSensors.DEVICE_MOTION_SENSORS);
diff.removeAll(DeviceSensors.DEVICE_ORIENTATION_SENSORS); diff.removeAll(DeviceSensors.DEVICE_ORIENTATION_SENSORS);
assertEquals(diff.size(), mMockSensorManager.numUnRegistered); assertEquals(diff.size(), mMockSensorManager.mNumUnRegistered);
mDeviceSensors.stop(DeviceSensors.DEVICE_ORIENTATION); mDeviceSensors.stop(DeviceSensors.DEVICE_ORIENTATION);
assertTrue("should contain no sensors", assertTrue("should contain no sensors",
mDeviceSensors.mActiveSensors.isEmpty()); mDeviceSensors.mActiveSensors.isEmpty());
assertEquals(diff.size() + DeviceSensors.DEVICE_ORIENTATION_SENSORS.size(), assertEquals(diff.size() + DeviceSensors.DEVICE_ORIENTATION_SENSORS.size(),
mMockSensorManager.numUnRegistered); mMockSensorManager.mNumUnRegistered);
assertEquals(0, mDeviceSensors.getNumberActiveDeviceMotionSensors()); assertEquals(0, mDeviceSensors.getNumberActiveDeviceMotionSensors());
} }
...@@ -316,9 +316,9 @@ public class DeviceSensorsTest extends AndroidTestCase { ...@@ -316,9 +316,9 @@ public class DeviceSensorsTest extends AndroidTestCase {
private static class DeviceSensorsForTests extends DeviceSensors { private static class DeviceSensorsForTests extends DeviceSensors {
private double value1 = 0; private double mValue1 = 0;
private double value2 = 0; private double mValue2 = 0;
private double value3 = 0; private double mValue3 = 0;
private String mCalls = ""; private String mCalls = "";
private DeviceSensorsForTests(Context context) { private DeviceSensorsForTests(Context context) {
...@@ -330,15 +330,15 @@ public class DeviceSensorsTest extends AndroidTestCase { ...@@ -330,15 +330,15 @@ public class DeviceSensorsTest extends AndroidTestCase {
} }
private void verifyValues(double v1, double v2, double v3) { private void verifyValues(double v1, double v2, double v3) {
assertEquals(v1, value1); assertEquals(v1, mValue1);
assertEquals(v2, value2); assertEquals(v2, mValue2);
assertEquals(v3, value3); assertEquals(v3, mValue3);
} }
private void verifyValuesEpsilon(double v1, double v2, double v3) { private void verifyValuesEpsilon(double v1, double v2, double v3) {
assertEquals(v1, value1, 0.1); assertEquals(v1, mValue1, 0.1);
assertEquals(v2, value2, 0.1); assertEquals(v2, mValue2, 0.1);
assertEquals(v3, value3, 0.1); assertEquals(v3, mValue3, 0.1);
} }
private void verifyCalls(String names) { private void verifyCalls(String names) {
...@@ -347,33 +347,33 @@ public class DeviceSensorsTest extends AndroidTestCase { ...@@ -347,33 +347,33 @@ public class DeviceSensorsTest extends AndroidTestCase {
@Override @Override
protected void gotOrientation(double alpha, double beta, double gamma) { protected void gotOrientation(double alpha, double beta, double gamma) {
value1 = alpha; mValue1 = alpha;
value2 = beta; mValue2 = beta;
value3 = gamma; mValue3 = gamma;
mCalls = mCalls.concat("gotOrientation"); mCalls = mCalls.concat("gotOrientation");
} }
@Override @Override
protected void gotAcceleration(double x, double y, double z) { protected void gotAcceleration(double x, double y, double z) {
value1 = x; mValue1 = x;
value2 = y; mValue2 = y;
value3 = z; mValue3 = z;
mCalls = mCalls.concat("gotAcceleration"); mCalls = mCalls.concat("gotAcceleration");
} }
@Override @Override
protected void gotAccelerationIncludingGravity(double x, double y, double z) { protected void gotAccelerationIncludingGravity(double x, double y, double z) {
value1 = x; mValue1 = x;
value2 = y; mValue2 = y;
value3 = z; mValue3 = z;
mCalls = mCalls.concat("gotAccelerationIncludingGravity"); mCalls = mCalls.concat("gotAccelerationIncludingGravity");
} }
@Override @Override
protected void gotRotationRate(double alpha, double beta, double gamma) { protected void gotRotationRate(double alpha, double beta, double gamma) {
value1 = alpha; mValue1 = alpha;
value2 = beta; mValue2 = beta;
value3 = gamma; mValue3 = gamma;
mCalls = mCalls.concat("gotRotationRate"); mCalls = mCalls.concat("gotRotationRate");
} }
} }
...@@ -381,8 +381,8 @@ public class DeviceSensorsTest extends AndroidTestCase { ...@@ -381,8 +381,8 @@ public class DeviceSensorsTest extends AndroidTestCase {
private static class MockSensorManager implements private static class MockSensorManager implements
DeviceSensors.SensorManagerProxy { DeviceSensors.SensorManagerProxy {
private int numRegistered = 0; private int mNumRegistered = 0;
private int numUnRegistered = 0; private int mNumUnRegistered = 0;
private MockSensorManager() { private MockSensorManager() {
} }
...@@ -390,13 +390,13 @@ public class DeviceSensorsTest extends AndroidTestCase { ...@@ -390,13 +390,13 @@ public class DeviceSensorsTest extends AndroidTestCase {
@Override @Override
public boolean registerListener(SensorEventListener listener, int sensorType, int rate, public boolean registerListener(SensorEventListener listener, int sensorType, int rate,
Handler handler) { Handler handler) {
numRegistered++; mNumRegistered++;
return true; return true;
} }
@Override @Override
public void unregisterListener(SensorEventListener listener, int sensorType) { public void unregisterListener(SensorEventListener listener, int sensorType) {
numUnRegistered++; mNumUnRegistered++;
} }
} }
} }
...@@ -195,12 +195,12 @@ public class MediaResourceGetterTest extends InstrumentationTestCase { ...@@ -195,12 +195,12 @@ public class MediaResourceGetterTest extends InstrumentationTestCase {
* Helper class to control the result of permission checks. * Helper class to control the result of permission checks.
*/ */
private static class InternalMockContext extends MockContext { private static class InternalMockContext extends MockContext {
boolean allowPermission = false; boolean mAllowPermission = false;
@Override @Override
public int checkCallingOrSelfPermission(String permission) { public int checkCallingOrSelfPermission(String permission) {
assertEquals(android.Manifest.permission.ACCESS_NETWORK_STATE, assertEquals(android.Manifest.permission.ACCESS_NETWORK_STATE,
permission); permission);
return allowPermission ? PackageManager.PERMISSION_GRANTED : return mAllowPermission ? PackageManager.PERMISSION_GRANTED :
PackageManager.PERMISSION_DENIED; PackageManager.PERMISSION_DENIED;
} }
} }
...@@ -256,14 +256,14 @@ public class MediaResourceGetterTest extends InstrumentationTestCase { ...@@ -256,14 +256,14 @@ public class MediaResourceGetterTest extends InstrumentationTestCase {
@SmallTest @SmallTest
public void testConfigure_Net_NoPermissions() { public void testConfigure_Net_NoPermissions() {
mMockContext.allowPermission = false; mMockContext.mAllowPermission = false;
assertFalse(mFakeMRG.configure(mMockContext, TEST_HTTP_URL, assertFalse(mFakeMRG.configure(mMockContext, TEST_HTTP_URL,
TEST_COOKIES, TEST_USER_AGENT)); TEST_COOKIES, TEST_USER_AGENT));
} }
@SmallTest @SmallTest
public void testConfigure_Net_NoActiveNetwork() { public void testConfigure_Net_NoActiveNetwork() {
mMockContext.allowPermission = true; mMockContext.mAllowPermission = true;
mFakeMRG.mNetworkType = null; mFakeMRG.mNetworkType = null;
assertFalse(mFakeMRG.configure(mMockContext, TEST_HTTP_URL, assertFalse(mFakeMRG.configure(mMockContext, TEST_HTTP_URL,
TEST_COOKIES, TEST_USER_AGENT)); TEST_COOKIES, TEST_USER_AGENT));
...@@ -271,7 +271,7 @@ public class MediaResourceGetterTest extends InstrumentationTestCase { ...@@ -271,7 +271,7 @@ public class MediaResourceGetterTest extends InstrumentationTestCase {
@SmallTest @SmallTest
public void testConfigure_Net_Disallowed_Mobile() { public void testConfigure_Net_Disallowed_Mobile() {
mMockContext.allowPermission = true; mMockContext.mAllowPermission = true;
mFakeMRG.mNetworkType = ConnectivityManager.TYPE_MOBILE; mFakeMRG.mNetworkType = ConnectivityManager.TYPE_MOBILE;
assertFalse(mFakeMRG.configure(mMockContext, TEST_HTTP_URL, assertFalse(mFakeMRG.configure(mMockContext, TEST_HTTP_URL,
TEST_COOKIES, TEST_USER_AGENT)); TEST_COOKIES, TEST_USER_AGENT));
...@@ -279,7 +279,7 @@ public class MediaResourceGetterTest extends InstrumentationTestCase { ...@@ -279,7 +279,7 @@ public class MediaResourceGetterTest extends InstrumentationTestCase {
@SmallTest @SmallTest
public void testConfigure_Net_Disallowed_Wimax() { public void testConfigure_Net_Disallowed_Wimax() {
mMockContext.allowPermission = true; mMockContext.mAllowPermission = true;
mFakeMRG.mNetworkType = ConnectivityManager.TYPE_WIMAX; mFakeMRG.mNetworkType = ConnectivityManager.TYPE_WIMAX;
assertFalse(mFakeMRG.configure(mMockContext, TEST_HTTP_URL, assertFalse(mFakeMRG.configure(mMockContext, TEST_HTTP_URL,
TEST_COOKIES, TEST_USER_AGENT)); TEST_COOKIES, TEST_USER_AGENT));
...@@ -287,7 +287,7 @@ public class MediaResourceGetterTest extends InstrumentationTestCase { ...@@ -287,7 +287,7 @@ public class MediaResourceGetterTest extends InstrumentationTestCase {
@SmallTest @SmallTest
public void testConfigure_Net_Allowed_Ethernet_Cookies_NoUA() { public void testConfigure_Net_Allowed_Ethernet_Cookies_NoUA() {
mMockContext.allowPermission = true; mMockContext.mAllowPermission = true;
mFakeMRG.mNetworkType = ConnectivityManager.TYPE_ETHERNET; mFakeMRG.mNetworkType = ConnectivityManager.TYPE_ETHERNET;
assertTrue(mFakeMRG.configure(mMockContext, TEST_HTTP_URL, assertTrue(mFakeMRG.configure(mMockContext, TEST_HTTP_URL,
TEST_COOKIES, null)); TEST_COOKIES, null));
...@@ -298,7 +298,7 @@ public class MediaResourceGetterTest extends InstrumentationTestCase { ...@@ -298,7 +298,7 @@ public class MediaResourceGetterTest extends InstrumentationTestCase {
@SmallTest @SmallTest
public void testConfigure_Net_Allowed_Wifi_Cookies_NoUA() { public void testConfigure_Net_Allowed_Wifi_Cookies_NoUA() {
mMockContext.allowPermission = true; mMockContext.mAllowPermission = true;
mFakeMRG.mNetworkType = ConnectivityManager.TYPE_WIFI; mFakeMRG.mNetworkType = ConnectivityManager.TYPE_WIFI;
assertTrue(mFakeMRG.configure(mMockContext, TEST_HTTP_URL, assertTrue(mFakeMRG.configure(mMockContext, TEST_HTTP_URL,
TEST_COOKIES, null)); TEST_COOKIES, null));
...@@ -309,7 +309,7 @@ public class MediaResourceGetterTest extends InstrumentationTestCase { ...@@ -309,7 +309,7 @@ public class MediaResourceGetterTest extends InstrumentationTestCase {
@SmallTest @SmallTest
public void testConfigure_Net_Allowed_Ethernet_NoCookies_NoUA() { public void testConfigure_Net_Allowed_Ethernet_NoCookies_NoUA() {
mMockContext.allowPermission = true; mMockContext.mAllowPermission = true;
mFakeMRG.mNetworkType = ConnectivityManager.TYPE_ETHERNET; mFakeMRG.mNetworkType = ConnectivityManager.TYPE_ETHERNET;
assertTrue(mFakeMRG.configure(mMockContext, TEST_HTTP_URL, assertTrue(mFakeMRG.configure(mMockContext, TEST_HTTP_URL,
"", null)); "", null));
...@@ -320,7 +320,7 @@ public class MediaResourceGetterTest extends InstrumentationTestCase { ...@@ -320,7 +320,7 @@ public class MediaResourceGetterTest extends InstrumentationTestCase {
@SmallTest @SmallTest
public void testConfigure_Net_Allowed_Ethernet_Cookies_WithUA() { public void testConfigure_Net_Allowed_Ethernet_Cookies_WithUA() {
mMockContext.allowPermission = true; mMockContext.mAllowPermission = true;
mFakeMRG.mNetworkType = ConnectivityManager.TYPE_ETHERNET; mFakeMRG.mNetworkType = ConnectivityManager.TYPE_ETHERNET;
assertTrue(mFakeMRG.configure(mMockContext, TEST_HTTP_URL, assertTrue(mFakeMRG.configure(mMockContext, TEST_HTTP_URL,
TEST_COOKIES, TEST_USER_AGENT)); TEST_COOKIES, TEST_USER_AGENT));
...@@ -331,7 +331,7 @@ public class MediaResourceGetterTest extends InstrumentationTestCase { ...@@ -331,7 +331,7 @@ public class MediaResourceGetterTest extends InstrumentationTestCase {
@SmallTest @SmallTest
public void testConfigure_Net_Allowed_Ethernet_NoCookies_WithUA() { public void testConfigure_Net_Allowed_Ethernet_NoCookies_WithUA() {
mMockContext.allowPermission = true; mMockContext.mAllowPermission = true;
mFakeMRG.mNetworkType = ConnectivityManager.TYPE_ETHERNET; mFakeMRG.mNetworkType = ConnectivityManager.TYPE_ETHERNET;
assertTrue(mFakeMRG.configure(mMockContext, TEST_HTTP_URL, assertTrue(mFakeMRG.configure(mMockContext, TEST_HTTP_URL,
"", TEST_USER_AGENT)); "", TEST_USER_AGENT));
...@@ -342,7 +342,7 @@ public class MediaResourceGetterTest extends InstrumentationTestCase { ...@@ -342,7 +342,7 @@ public class MediaResourceGetterTest extends InstrumentationTestCase {
@SmallTest @SmallTest
public void testConfigure_Net_Allowed_Ethernet_Exception() { public void testConfigure_Net_Allowed_Ethernet_Exception() {
mMockContext.allowPermission = true; mMockContext.mAllowPermission = true;
mFakeMRG.mThrowExceptionInConfigure = true; mFakeMRG.mThrowExceptionInConfigure = true;
mFakeMRG.mNetworkType = ConnectivityManager.TYPE_ETHERNET; mFakeMRG.mNetworkType = ConnectivityManager.TYPE_ETHERNET;
assertFalse(mFakeMRG.configure(mMockContext, TEST_HTTP_URL, assertFalse(mFakeMRG.configure(mMockContext, TEST_HTTP_URL,
...@@ -358,7 +358,7 @@ public class MediaResourceGetterTest extends InstrumentationTestCase { ...@@ -358,7 +358,7 @@ public class MediaResourceGetterTest extends InstrumentationTestCase {
"https://127.0.0.1/", "https://127.0.0.1/",
"http://[::1]:8888/", "http://[::1]:8888/",
}; };
mMockContext.allowPermission = true; mMockContext.mAllowPermission = true;
mFakeMRG.mNetworkType = null; mFakeMRG.mNetworkType = null;
for (String localHostUrl : localHostUrls) { for (String localHostUrl : localHostUrls) {
assertTrue(mFakeMRG.configure(mMockContext, localHostUrl, assertTrue(mFakeMRG.configure(mMockContext, localHostUrl,
......
...@@ -40,10 +40,10 @@ public class InvalidationPreferences { ...@@ -40,10 +40,10 @@ public class InvalidationPreferences {
* Used to avoid exposing raw preference objects to users of this class. * Used to avoid exposing raw preference objects to users of this class.
*/ */
public class EditContext { public class EditContext {
private final SharedPreferences.Editor editor; private final SharedPreferences.Editor mEditor;
EditContext() { EditContext() {
this.editor = PreferenceManager.getDefaultSharedPreferences(mContext).edit(); mEditor = PreferenceManager.getDefaultSharedPreferences(mContext).edit();
} }
} }
...@@ -94,7 +94,7 @@ public class InvalidationPreferences { ...@@ -94,7 +94,7 @@ public class InvalidationPreferences {
* NOTE: this method performs blocking I/O and must not be called from the UI thread. * NOTE: this method performs blocking I/O and must not be called from the UI thread.
*/ */
public boolean commit(EditContext editContext) { public boolean commit(EditContext editContext) {
if (!editContext.editor.commit()) { if (!editContext.mEditor.commit()) {
Log.w(TAG, "Failed to commit invalidation preferences"); Log.w(TAG, "Failed to commit invalidation preferences");
return false; return false;
} }
...@@ -111,7 +111,7 @@ public class InvalidationPreferences { ...@@ -111,7 +111,7 @@ public class InvalidationPreferences {
public void setSyncTypes(EditContext editContext, Collection<String> syncTypes) { public void setSyncTypes(EditContext editContext, Collection<String> syncTypes) {
Preconditions.checkNotNull(syncTypes); Preconditions.checkNotNull(syncTypes);
Set<String> selectedTypesSet = new HashSet<String>(syncTypes); Set<String> selectedTypesSet = new HashSet<String>(syncTypes);
editContext.editor.putStringSet(PrefKeys.SYNC_TANGO_TYPES, selectedTypesSet); editContext.mEditor.putStringSet(PrefKeys.SYNC_TANGO_TYPES, selectedTypesSet);
} }
/** Returns the saved non-sync object ids, or {@code null} if none exist. */ /** Returns the saved non-sync object ids, or {@code null} if none exist. */
...@@ -139,7 +139,7 @@ public class InvalidationPreferences { ...@@ -139,7 +139,7 @@ public class InvalidationPreferences {
for (ObjectId objectId : objectIds) { for (ObjectId objectId : objectIds) {
objectIdStrings.add(getObjectIdString(objectId)); objectIdStrings.add(getObjectIdString(objectId));
} }
editContext.editor.putStringSet(PrefKeys.TANGO_OBJECT_IDS, objectIdStrings); editContext.mEditor.putStringSet(PrefKeys.TANGO_OBJECT_IDS, objectIdStrings);
} }
/** Returns the saved account, or {@code null} if none exists. */ /** Returns the saved account, or {@code null} if none exists. */
...@@ -155,8 +155,8 @@ public class InvalidationPreferences { ...@@ -155,8 +155,8 @@ public class InvalidationPreferences {
/** Sets the saved account to {@code account} in {@code editContext}. */ /** Sets the saved account to {@code account} in {@code editContext}. */
public void setAccount(EditContext editContext, Account account) { public void setAccount(EditContext editContext, Account account) {
editContext.editor.putString(PrefKeys.SYNC_ACCT_NAME, account.name); editContext.mEditor.putString(PrefKeys.SYNC_ACCT_NAME, account.name);
editContext.editor.putString(PrefKeys.SYNC_ACCT_TYPE, account.type); editContext.mEditor.putString(PrefKeys.SYNC_ACCT_TYPE, account.type);
} }
/** Returns the notification client internal state. */ /** Returns the notification client internal state. */
...@@ -171,7 +171,7 @@ public class InvalidationPreferences { ...@@ -171,7 +171,7 @@ public class InvalidationPreferences {
/** Sets the notification client internal state to {@code state}. */ /** Sets the notification client internal state to {@code state}. */
public void setInternalNotificationClientState(EditContext editContext, byte[] state) { public void setInternalNotificationClientState(EditContext editContext, byte[] state) {
editContext.editor.putString(PrefKeys.SYNC_TANGO_INTERNAL_STATE, editContext.mEditor.putString(PrefKeys.SYNC_TANGO_INTERNAL_STATE,
Base64.encodeToString(state, Base64.DEFAULT)); Base64.encodeToString(state, Base64.DEFAULT));
} }
......
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
</module> </module>
<!-- Non-public, non-static field names start with m. --> <!-- Non-public, non-static field names start with m. -->
<module name="MemberName"> <module name="MemberName">
<property name="severity" value="error"/>
<property name="format" value="^m[A-Z][a-zA-Z0-9]*$"/> <property name="format" value="^m[A-Z][a-zA-Z0-9]*$"/>
<property name="applyToPublic" value="false"/> <property name="applyToPublic" value="false"/>
<message key="name.invalidPattern" value="Non-public, non-static field names start with m."/> <message key="name.invalidPattern" value="Non-public, non-static field names start with m."/>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment