chromium/chrome/browser/web_applications/web_app_database_unittest.cc

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

#include "chrome/browser/web_applications/web_app_database.h"

#include <memory>
#include <string>
#include <utility>
#include <vector>

#include "base/base64.h"
#include "base/files/file_path.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/test_future.h"
#include "base/time/time.h"
#include "chrome/browser/web_applications/isolated_web_apps/isolated_web_app_integrity_block_data.h"
#include "chrome/browser/web_applications/isolated_web_apps/isolated_web_app_storage_location.h"
#include "chrome/browser/web_applications/mojom/user_display_mode.mojom-shared.h"
#include "chrome/browser/web_applications/mojom/user_display_mode.mojom.h"
#include "chrome/browser/web_applications/proto/web_app.pb.h"
#include "chrome/browser/web_applications/proto/web_app_install_state.pb.h"
#include "chrome/browser/web_applications/scope_extension_info.h"
#include "chrome/browser/web_applications/test/fake_web_app_database_factory.h"
#include "chrome/browser/web_applications/test/fake_web_app_provider.h"
#include "chrome/browser/web_applications/test/web_app_test.h"
#include "chrome/browser/web_applications/test/web_app_test_utils.h"
#include "chrome/browser/web_applications/user_display_mode.h"
#include "chrome/browser/web_applications/web_app.h"
#include "chrome/browser/web_applications/web_app_command_manager.h"
#include "chrome/browser/web_applications/web_app_constants.h"
#include "chrome/browser/web_applications/web_app_helpers.h"
#include "chrome/browser/web_applications/web_app_install_info.h"
#include "chrome/browser/web_applications/web_app_install_manager.h"
#include "chrome/browser/web_applications/web_app_proto_utils.h"
#include "chrome/browser/web_applications/web_app_registrar.h"
#include "chrome/browser/web_applications/web_app_registry_update.h"
#include "chrome/browser/web_applications/web_app_sync_bridge.h"
#include "chrome/browser/web_applications/web_app_utils.h"
#include "components/services/app_service/public/cpp/file_handler.h"
#include "components/services/app_service/public/cpp/protocol_handler_info.h"
#include "components/services/app_service/public/cpp/share_target.h"
#include "components/services/app_service/public/cpp/url_handler_info.h"
#include "components/sync/model/data_type_store.h"
#include "components/sync/protocol/web_app_specifics.pb.h"
#include "components/sync/test/mock_data_type_local_change_processor.h"
#include "components/web_package/signed_web_bundles/ed25519_public_key.h"
#include "components/web_package/signed_web_bundles/ed25519_signature.h"
#include "components/web_package/signed_web_bundles/signed_web_bundle_signature_stack_entry.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
#include "third_party/blink/public/common/permissions_policy/origin_with_possible_wildcards.h"
#include "third_party/blink/public/common/permissions_policy/permissions_policy_declaration.h"
#include "third_party/blink/public/mojom/permissions_policy/permissions_policy_feature.mojom.h"
#include "url/gurl.h"
#include "url/origin.h"

namespace web_app {

Eq;
Field;
IsNull;
NotNull;
Optional;
Property;
VariantWith;

class WebAppDatabaseTest : public WebAppTest {};

TEST_F(WebAppDatabaseTest, WriteAndReadRegistry) {}

TEST_F(WebAppDatabaseTest, WriteAndDeleteAppsWithCallbacks) {}

// Read a database where all apps are already in a valid state, so there should
// be no difference between the apps written and read.
TEST_F(WebAppDatabaseTest, OpenDatabaseAndReadRegistry) {}

// Read a database where some apps will be migrated at read time.
TEST_F(WebAppDatabaseTest, OpenDatabaseAndReadRegistryWithMigration) {}

TEST_F(WebAppDatabaseTest, BackwardCompatibility_WebAppWithOnlyRequiredFields) {}

TEST_F(WebAppDatabaseTest, UserDisplayModeCrosOnly_MigratesToCurrentPlatform) {}

TEST_F(WebAppDatabaseTest,
       UserDisplayModeDefaultOnly_MigratesToCurrentPlatform) {}

TEST_F(WebAppDatabaseTest, WebAppWithoutOptionalFields) {}

TEST_F(WebAppDatabaseTest, WebAppWithManyIcons) {}

TEST_F(WebAppDatabaseTest, MigrateOldLaunchHandlerSyntax) {}

// Tests handling crashes fixed in crbug.com/1417955.
TEST_F(WebAppDatabaseTest, MigrateFromMissingShortcutsSizes) {}

// Old versions of Chrome may have stored sync data with a manifest_id_path
// containing a fragment part in the URL. It should be stripped out, because the
// spec requires that ManifestIds with different fragments are considered
// equivalent.
TEST_F(WebAppDatabaseTest, RemovesFragmentFromSyncProtoManifestIdPath) {}

TEST_F(WebAppDatabaseTest, RemovesFragmentAndQueriesFromScopeDuringParsing) {}

class WebAppDatabaseProtoDataTest : public ::testing::Test {};

TEST_F(WebAppDatabaseProtoDataTest, DoesNotSetIsolationDataIfNotIsolated) {}

TEST_F(WebAppDatabaseProtoDataTest, SavesOwnedBundleIsolationData) {}

TEST_F(WebAppDatabaseProtoDataTest, HandlesCorruptedOwnedBundleIsolationData) {}

TEST_F(WebAppDatabaseProtoDataTest, SavesUnownedBundleIsolationData) {}

TEST_F(WebAppDatabaseProtoDataTest,
       HandlesCorruptedUnownedBundleIsolationData) {}

TEST_F(WebAppDatabaseProtoDataTest, SavesProxyIsolationData) {}

TEST_F(WebAppDatabaseProtoDataTest, HandlesCorruptedProxyIsolationData) {}

TEST_F(WebAppDatabaseProtoDataTest, HandlesCorruptedIsolationDataVersion) {}

TEST_F(WebAppDatabaseProtoDataTest,
       HandlesCorruptedIsolationDataPendingUpdateVersion) {}

TEST_F(WebAppDatabaseProtoDataTest,
       HandlesDifferentTypeOfIsolationDataPendingUpdateLocation) {}

TEST_F(WebAppDatabaseProtoDataTest,
       HandlesMismatchedIsolationDataPendingUpdateLocation) {}

TEST_F(WebAppDatabaseProtoDataTest, SavesIsolationDataUpdateInfo) {}

TEST_F(WebAppDatabaseProtoDataTest, PermissionsPolicyRoundTrip) {}

TEST_F(WebAppDatabaseProtoDataTest, PermissionsPolicyProto) {}
}  // namespace web_app