#include "extensions/browser/updater/update_service.h"
#include <stddef.h>
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include <vector>
#include "base/containers/contains.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/raw_ptr.h"
#include "base/notreached.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/values.h"
#include "components/crx_file/id_util.h"
#include "components/update_client/crx_update_item.h"
#include "components/update_client/update_client.h"
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/test_utils.h"
#include "extensions/browser/allowlist_state.h"
#include "extensions/browser/blocklist_state.h"
#include "extensions/browser/disable_reason.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extensions_test.h"
#include "extensions/browser/mock_extension_system.h"
#include "extensions/browser/test_extensions_browser_client.h"
#include "extensions/browser/updater/extension_downloader.h"
#include "extensions/browser/updater/extension_update_data.h"
#include "extensions/browser/updater/uninstall_ping_sender.h"
#include "extensions/common/extension_builder.h"
#include "extensions/common/extension_features.h"
#include "extensions/common/extension_id.h"
#include "extensions/common/extension_urls.h"
#include "extensions/common/manifest_url_handlers.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
UpdateClientEvents;
class FakeUpdateClient : public update_client::UpdateClient { … };
FakeUpdateClient::FakeUpdateClient() = default;
void FakeUpdateClient::Update(const std::vector<std::string>& ids,
CrxDataCallback crx_data_callback,
CrxStateChangeCallback crx_state_change_callback,
bool is_foreground,
update_client::Callback callback) { … }
}
namespace extensions {
namespace {
UninstallPingSender::FilterResult g_should_ping = …;
UninstallPingSender::FilterResult ShouldPing(const Extension* extension,
UninstallReason reason) { … }
class FakeExtensionSystem : public MockExtensionSystem { … };
class UpdateServiceTest : public ExtensionsTest { … };
TEST_F(UpdateServiceTest, BasicUpdateOperations_InstallImmediately) { … }
TEST_F(UpdateServiceTest, BasicUpdateOperations_NotInstallImmediately) { … }
TEST_F(UpdateServiceTest, BasicUpdateOperations_NoUpdateFoundCallback) { … }
TEST_F(UpdateServiceTest, UninstallPings) { … }
TEST_F(UpdateServiceTest, CheckOmahaMalwareAttributes) { … }
TEST_F(UpdateServiceTest, CheckOmahaAllowlistAttributes) { … }
TEST_F(UpdateServiceTest, CheckNoOmahaAttributes) { … }
TEST_F(UpdateServiceTest, InProgressUpdate_Successful) { … }
TEST_F(UpdateServiceTest, InProgressUpdate_DuplicateWithDifferentData) { … }
TEST_F(UpdateServiceTest, InProgressUpdate_NonOverlapped) { … }
}
}