Best code examples for Android RenamingDelegatingContext class (android.test.RenamingDelegatingContext)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android RenamingDelegatingContext class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Android RenamingDelegatingContext examples from Open Source projects
This code example shows how to use the following methods:
	@Override 
	protected void setUp() throws Exception { 
		super.setUp(); 
 
		RenamingDelegatingContext context 
		= new RenamingDelegatingContext(getContext(), TEST_FILE_PREFIX);
 
		itemsAdapter = new ItemsDbAdapter(context);
		itemsAdapter.open();
		listAdapter = new ListsDbAdapter(context);
		listAdapter.open();
	} 
 
	@Override 
	protected void tearDown() throws Exception { 
		super.tearDown(); 
 
		itemsAdapter.close();
		itemsAdapter = null;
		listAdapter.close();
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: makeExistingFilesAndDbsAccessible
            public String getPackageName() {
                return "no.package"; 
            } 
        }; 
        RenamingDelegatingContext targetContextWrapper =
                new RenamingDelegatingContext(context, targetContext, "perf.");
        targetContextWrapper.makeExistingFilesAndDbsAccessible();
        IsolatedContext providerContext = new IsolatedContext(resolver, targetContextWrapper);
        SynchronousContactsProvider2 provider = new SynchronousContactsProvider2();
        provider.setDataWipeEnabled(false);
        provider.attachInfo(providerContext, null);
        resolver.addProvider(ContactsContract.AUTHORITY, provider);
 
        long rawContactCount = provider.getRawContactCount();
        if (rawContactCount == 0) {
            Log.w(TAG, "The test has not been set up. Use this command to copy a contact db"
                    + " to the device:\nadb push <large contacts2.db> " 
                    + "data/data/com.android.providers.contacts/databases/perf.contacts2.db"); 
            return; 
        } 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods:
    protected Context targetContext;
 
    @Override 
    protected void setUp() { 
        // Run tests in an isolated context 
        targetContext = new RenamingDelegatingContext(getInstrumentation().getTargetContext(), "test_");
        testContext = getInstrumentation().getContext();
    } 
 
    public void testLoadDB() { 
        SQLiteDatabase db = TestUtils.loadDBFromDump(targetContext, testContext,
                "one_category.sql"); 
        CategoryNode node = CategoryNode.createCategoryTreeFromDB(1);
        // At least 1 category exists in test db: malformed_category_parent_id.sql 
        assertTrue((node.getChildren().size() != 0));
        db.close();
    } 
 
    public void testLoadDB_MalformedCategoryParentId() { 
        SQLiteDatabase db = TestUtils.loadDBFromDump(targetContext, testContext,
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: makeExistingFilesAndDbsAccessible
            @Override 
            public String getPackageName() {
                return "no.package"; 
            } 
        }; 
        RenamingDelegatingContext targetContextWrapper = new RenamingDelegatingContext(context,
                targetContext, "perf_imp.");
        targetContextWrapper.makeExistingFilesAndDbsAccessible();
        IsolatedContext providerContext = new IsolatedContext(resolver, targetContextWrapper);
        SynchronousContactsProvider2 provider = new SynchronousContactsProvider2();
        provider.setDataWipeEnabled(false);
        provider.attachInfo(providerContext, null);
        resolver.addProvider(ContactsContract.AUTHORITY, provider);
 
        ContentProvider callLogProvider = new TestCallLogProvider();
        callLogProvider.attachInfo(providerContext, null);
        resolver.addProvider(CallLog.AUTHORITY, callLogProvider);
 
        LegacyContactImporter importer = new LegacyContactImporter(providerContext, provider);
 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods:
	Account account;
	HomeScreenController controller;
	 
	protected void setUp() throws Exception { 
		super.setUp(); 
		RenamingDelegatingContext context = new RenamingDelegatingContext(
				getContext(), "_test");
		controller = new HomeScreenController(new HomeScreenModel(context));
		account = Account.getInstance(context);
 
	} 
	public void testCalculatePercentage() { 
		account.addBudgetItem(account.getCategory(Constants.EXPENSE_ID), 10.0);
		account.addTransaction(9.0, new Date(),"test", account.getCategory(Constants.EXPENSE_ID));
		controller.calculatePercentage();
		if(controller.getModel().getPercentage() != 90.0){
			fail("Calculate percantage doesn't work");
		} 
	} 
 
Full Snippet Info
5
CodeRank
Related Android RenamingDelegatingContext Questions & Answers:
See Code Examples for Android RenamingDelegatingContext Methods: