chromium/chrome/browser/ui/web_applications/web_app_badging_browsertest.cc

// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/test/bind.h"
#include "chrome/browser/apps/app_service/app_registry_cache_waiter.h"
#include "chrome/browser/badging/badge_manager.h"
#include "chrome/browser/badging/badge_manager_factory.h"
#include "chrome/browser/badging/test_badge_manager_delegate.h"
#include "chrome/browser/browsing_data/chrome_browsing_data_remover_constants.h"
#include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/web_applications/web_app_browsertest_base.h"
#include "chrome/browser/web_applications/mojom/user_display_mode.mojom.h"
#include "chrome/browser/web_applications/test/web_app_install_test_utils.h"
#include "chrome/browser/web_applications/web_app_install_info.h"
#include "chrome/browser/web_applications/web_app_provider.h"
#include "chrome/browser/web_applications/web_app_registrar.h"
#include "content/public/browser/browsing_data_filter_builder.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"

RenderFrameHost;

namespace web_app {

class WebAppBadgingBrowserTest : public WebAppBrowserTestBase {};

// Tests that the badge for the main frame is not affected by changing the badge
// of a cross site subframe.
IN_PROC_BROWSER_TEST_F(WebAppBadgingBrowserTest,
                       CrossSiteFrameCannotChangeMainFrameBadge) {}

// Tests that setting the badge to an integer will be propagated across
// processes.
IN_PROC_BROWSER_TEST_F(WebAppBadgingBrowserTest, BadgeCanBeSetToAnInteger) {}

// Tests that calls to |Badge.clear| are propagated across processes.
IN_PROC_BROWSER_TEST_F(WebAppBadgingBrowserTest,
                       BadgeCanBeClearedWithClearMethod) {}

// Tests that calling Badge.set(0) is equivalent to calling |Badge.clear| and
// that it propagates across processes.
IN_PROC_BROWSER_TEST_F(WebAppBadgingBrowserTest, BadgeCanBeClearedWithZero) {}

// Tests that setting the badge without content is propagated across processes.
IN_PROC_BROWSER_TEST_F(WebAppBadgingBrowserTest, BadgeCanBeSetWithoutAValue) {}

// Tests that the badge can be set and cleared from an in scope frame.
IN_PROC_BROWSER_TEST_F(WebAppBadgingBrowserTest,
                       BadgeCanBeSetAndClearedFromInScopeFrame) {}

// Tests that changing the badge of a subframe with an app affects the
// subframe's app.
IN_PROC_BROWSER_TEST_F(WebAppBadgingBrowserTest, SubFrameBadgeAffectsSubApp) {}

// Tests that setting a badge on a subframe with an app only effects the sub
// app.
IN_PROC_BROWSER_TEST_F(WebAppBadgingBrowserTest, BadgeSubFrameAppViaNavigator) {}

// Tests that setting a badge on a subframe via call() craziness sets the
// subframe app's badge.
IN_PROC_BROWSER_TEST_F(WebAppBadgingBrowserTest, BadgeSubFrameAppViaCall) {}

// Test that badging through a service worker scoped to the sub app updates
// badges for the sub app only.  These badge updates must not affect the main
// app.
IN_PROC_BROWSER_TEST_F(WebAppBadgingBrowserTest,
                       SubAppServiceWorkerBadgeAffectsSubApp) {}

// Test that badging through a service worker scoped to the main app updates
// badges for both the main app and the sub app.  Each service worker badge
// function call must generate 2 badge changes.
IN_PROC_BROWSER_TEST_F(WebAppBadgingBrowserTest,
                       AppServiceWorkerBadgeAffectsMultipleApps) {}

// Tests that badging incognito windows does not cause a crash.
IN_PROC_BROWSER_TEST_F(WebAppBadgingBrowserTest,
                       BadgingIncognitoWindowsDoesNotCrash) {}

IN_PROC_BROWSER_TEST_F(WebAppBadgingBrowserTest, ClearLastBadgingTime) {}

}  // namespace web_app