#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "extensions/browser/api/alarms/alarms_api.h"
#include <stddef.h>
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include "base/functional/bind.h"
#include "base/json/json_reader.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/test/simple_test_clock.h"
#include "base/test/values_test_util.h"
#include "base/values.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/fake_local_frame.h"
#include "extensions/browser/api/alarms/alarm_manager.h"
#include "extensions/browser/api/alarms/alarms_api_constants.h"
#include "extensions/browser/api_unittest.h"
#include "extensions/common/extension_builder.h"
#include "extensions/common/extension_id.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
JsAlarm;
namespace extensions {
namespace {
class AlarmDelegate : public AlarmManager::Delegate { … };
}
void RunScheduleNextPoll(AlarmManager* alarm_manager) { … }
class ExtensionAlarmsTest : public ApiUnitTest { … };
void ExtensionAlarmsTestGetAllAlarmsCallback(
const AlarmManager::AlarmList* alarms) { … }
void ExtensionAlarmsTestGetAlarmCallback(ExtensionAlarmsTest* test,
Alarm* alarm) { … }
TEST_F(ExtensionAlarmsTest, Create) { … }
void ExtensionAlarmsTestCreateRepeatingGetAlarmCallback(
ExtensionAlarmsTest* test,
Alarm* alarm) { … }
TEST_F(ExtensionAlarmsTest, CreateRepeating) { … }
void ExtensionAlarmsTestCreateAbsoluteGetAlarm2Callback(
ExtensionAlarmsTest* test,
Alarm* alarm) { … }
void ExtensionAlarmsTestCreateAbsoluteGetAlarm1Callback(
ExtensionAlarmsTest* test,
Alarm* alarm) { … }
TEST_F(ExtensionAlarmsTest, CreateAbsolute) { … }
void ExtensionAlarmsTestCreateRepeatingWithQuickFirstCallGetAlarm3Callback(
ExtensionAlarmsTest* test,
Alarm* alarm) { … }
void ExtensionAlarmsTestCreateRepeatingWithQuickFirstCallGetAlarm2Callback(
ExtensionAlarmsTest* test,
Alarm* alarm) { … }
void ExtensionAlarmsTestCreateRepeatingWithQuickFirstCallGetAlarm1Callback(
ExtensionAlarmsTest* test,
Alarm* alarm) { … }
TEST_F(ExtensionAlarmsTest, CreateRepeatingWithQuickFirstCall) { … }
void ExtensionAlarmsTestCreateDupeGetAllAlarmsCallback(
const AlarmManager::AlarmList* alarms) { … }
TEST_F(ExtensionAlarmsTest, CreateDupe) { … }
class ConsoleLogMessageLocalFrame : public content::FakeLocalFrame { … };
class ExtensionAlarmsLogTest : public ExtensionAlarmsTest { … };
TEST_F(ExtensionAlarmsLogTest, CreateDelayBelowMinimum) { … }
TEST_F(ExtensionAlarmsTest, Get) { … }
TEST_F(ExtensionAlarmsTest, GetAll) { … }
void ExtensionAlarmsTestClearGetAllAlarms2Callback(
const AlarmManager::AlarmList* alarms) { … }
void ExtensionAlarmsTestClearGetAllAlarms1Callback(
ExtensionAlarmsTest* test,
const AlarmManager::AlarmList* alarms) { … }
TEST_F(ExtensionAlarmsTest, Clear) { … }
void ExtensionAlarmsTestClearAllGetAllAlarms2Callback(
const AlarmManager::AlarmList* alarms) { … }
void ExtensionAlarmsTestClearAllGetAllAlarms1Callback(
ExtensionAlarmsTest* test,
const AlarmManager::AlarmList* alarms) { … }
TEST_F(ExtensionAlarmsTest, ClearAll) { … }
class ExtensionAlarmsSchedulingTest : public ExtensionAlarmsTest { … };
TEST_F(ExtensionAlarmsSchedulingTest, PollScheduling) { … }
TEST_F(ExtensionAlarmsSchedulingTest, ReleasedExtensionPollsInfrequently) { … }
TEST_F(ExtensionAlarmsSchedulingTest, TimerRunning) { … }
TEST_F(ExtensionAlarmsSchedulingTest, MinimumGranularity) { … }
TEST_F(ExtensionAlarmsSchedulingTest, DifferentMinimumGranularities) { … }
void FrequencyTestGetAlarmsCallback(ExtensionAlarmsTest* test, Alarm* alarm) { … }
TEST_F(ExtensionAlarmsSchedulingTest, PollFrequencyFromStoredAlarm) { … }
TEST_F(ExtensionAlarmsSchedulingTest, RepeatingAlarmsScheduledPredictably) { … }
}