Java Code Examples for org.chromium.base.Log#wtf()

The following examples show how to use org.chromium.base.Log#wtf() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SuggestionsCategoryInfo.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * Performs the View All action for the provided category, navigating navigating to the view
 * showing all the content.
 */
public void performViewAllAction(NewTabPageManager manager) {
    switch (mCategory) {
        case KnownCategories.BOOKMARKS:
            manager.navigateToBookmarks();
            break;
        case KnownCategories.DOWNLOADS:
            manager.navigateToDownloadManager();
            break;
        case KnownCategories.FOREIGN_TABS:
            manager.navigateToRecentTabs();
            break;
        case KnownCategories.PHYSICAL_WEB_PAGES:
        case KnownCategories.RECENT_TABS:
        case KnownCategories.ARTICLES:
        default:
            Log.wtf(TAG, "'Empty State' action called for unsupported category: %d", mCategory);
            break;
    }
}
 
Example 2
Source File: NewTabPageAdapter.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * Dismisses the item at the provided adapter position. Can also cause the dismissal of other
 * items or even entire sections.
 */
// TODO(crbug.com/635567): Fix this properly.
@SuppressLint("SwitchIntDef")
public void dismissItem(int position) {
    int itemViewType = getItemViewType(position);

    // TODO(dgn): Polymorphism is supposed to allow to avoid that kind of stuff.
    switch (itemViewType) {
        case ItemViewType.STATUS:
        case ItemViewType.ACTION:
            dismissSection(getSuggestionsSection(position));
            return;

        case ItemViewType.SNIPPET:
            dismissSuggestion(position);
            return;

        case ItemViewType.PROMO:
            dismissPromo();
            return;

        default:
            Log.wtf(TAG, "Unsupported dismissal of item of type %d", itemViewType);
            return;
    }
}
 
Example 3
Source File: Linker.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Get Linker implementation type.
 * For testing.
 *
 * @return LINKER_IMPLEMENTATION_LEGACY or LINKER_IMPLEMENTATION_MODERN
 */
public final int getImplementationForTesting() {
    // Sanity check. This method may only be called during tests.
    assertLinkerTestsAreEnabled();

    synchronized (sSingletonLock) {
        assertForTesting(sSingleton == this);

        if (sSingleton instanceof ModernLinker) {
            return LINKER_IMPLEMENTATION_MODERN;
        } else if (sSingleton instanceof LegacyLinker) {
            return LINKER_IMPLEMENTATION_LEGACY;
        } else {
            Log.wtf(TAG, "Invalid linker: " + sSingleton.getClass().getName());
            assertForTesting(false);
        }
        return 0;
    }
}
 
Example 4
Source File: SuggestionsCategoryInfo.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Performs the View All action for the provided category, navigating navigating to the view
 * showing all the content.
 */
public void performViewAllAction(SuggestionsNavigationDelegate navigationDelegate) {
    switch (mCategory) {
        case KnownCategories.BOOKMARKS:
            navigationDelegate.navigateToBookmarks();
            break;
        case KnownCategories.DOWNLOADS:
            navigationDelegate.navigateToDownloadManager();
            break;
        case KnownCategories.FOREIGN_TABS:
            navigationDelegate.navigateToRecentTabs();
            break;
        case KnownCategories.PHYSICAL_WEB_PAGES:
        case KnownCategories.RECENT_TABS:
        case KnownCategories.ARTICLES:
        default:
            Log.wtf(TAG, "'Empty State' action called for unsupported category: %d", mCategory);
            break;
    }
}
 
Example 5
Source File: StatusListItem.java    From delion with Apache License 2.0 5 votes vote down vote up
public static StatusListItem create(
        int disabledReason, NewTabPageAdapter adapter, NewTabPageManager manager) {
    switch (disabledReason) {
        case DisabledReason.NONE:
            return new NoSnippets(adapter);

        case DisabledReason.SIGNED_OUT:
            return new SignedOut();

        case DisabledReason.SYNC_DISABLED:
            return new SyncDisabled();

        case DisabledReason.PASSPHRASE_ENCRYPTION_ENABLED:
            return new PassphraseEncryptionEnabled(manager);

        case DisabledReason.HISTORY_SYNC_STATE_UNKNOWN:
            // This should only be a transient state: during app launch, or when the sync
            // settings are being modified, and the user should never see a card showing this.
            // So let's just use HistorySyncDisabled as fallback.
            // TODO(dgn): If we add a spinner at some point (e.g. to show that we are fetching
            // snippets) we could use it here too.
        case DisabledReason.HISTORY_SYNC_DISABLED:
            return new HistorySyncDisabled();

        case DisabledReason.EXPLICITLY_DISABLED:
            Log.wtf(TAG, "FATAL: Attempted to create a status card while the feature should be "
                    + "off.");
            return null;

        default:
            Log.wtf(TAG, "FATAL: Attempted to create a status card for an unknown value: %d",
                    disabledReason);
            return null;
    }
}
 
Example 6
Source File: Linker.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Instantiate and run the current TestRunner, if any. The TestRunner implementation
 * must be instantiated _after_ all libraries are loaded to ensure that its
 * native methods are properly registered.
 *
 * @param memoryDeviceConfig LegacyLinker memory config, or 0 if unused
 * @param inBrowserProcess true if in the browser process
 */
protected final void runTestRunnerClassForTesting(int memoryDeviceConfig,
                                                  boolean inBrowserProcess) {
    if (DEBUG) {
        Log.i(TAG, "runTestRunnerClassForTesting called");
    }
    // Sanity check. This method may only be called during tests.
    assertLinkerTestsAreEnabled();

    synchronized (mLock) {
        if (mTestRunnerClassName == null) {
            Log.wtf(TAG, "Linker runtime tests not set up for this process");
            assertForTesting(false);
        }
        if (DEBUG) {
            Log.i(TAG, "Instantiating " + mTestRunnerClassName);
        }
        TestRunner testRunner = null;
        try {
            testRunner = (TestRunner) Class.forName(mTestRunnerClassName).newInstance();
        } catch (Exception e) {
            Log.wtf(TAG, "Could not instantiate test runner class by name", e);
            assertForTesting(false);
        }

        if (!testRunner.runChecks(memoryDeviceConfig, inBrowserProcess)) {
            Log.wtf(TAG, "Linker runtime tests failed in this process");
            assertForTesting(false);
        }

        Log.i(TAG, "All linker tests passed");
    }
}