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