| Index: content/common/mac/activity_unittest.mm
|
| diff --git a/content/common/mac/activity_unittest.mm b/content/common/mac/activity_unittest.mm
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..fd9854f91d8b00c9fe0f728e308512fa5c51ceb6
|
| --- /dev/null
|
| +++ b/content/common/mac/activity_unittest.mm
|
| @@ -0,0 +1,38 @@
|
| +// Copyright 2017 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "content/common/mac/activity.h"
|
| +
|
| +#include "testing/gtest_mac.h"
|
| +#include "testing/platform_test.h"
|
| +#import "third_party/ocmock/OCMock/OCMock.h"
|
| +#include "third_party/ocmock/gtest_support.h"
|
| +
|
| +class ActivityTest : public PlatformTest {};
|
| +
|
| +TEST_F(ActivityTest, StoresAssertion) {
|
| + const NSActivityOptions expectedOptions =
|
| + (NSActivityUserInitiatedAllowingIdleSystemSleep |
|
| + NSActivityLatencyCritical) &
|
| + ~(NSActivitySuddenTerminationDisabled |
|
| + NSActivityAutomaticTerminationDisabled);
|
| + id processInfoMock =
|
| + [OCMockObject partialMockForObject:[NSProcessInfo processInfo]];
|
| + id assertion = @"An activity assertion";
|
| + [[[processInfoMock expect] andReturn:assertion]
|
| + beginActivityWithOptions:expectedOptions
|
| + reason:OCMOCK_ANY];
|
| +
|
| + mac::Activity activity;
|
| + activity.Begin();
|
| +
|
| + EXPECT_OCMOCK_VERIFY(processInfoMock);
|
| +
|
| + [[processInfoMock expect] endActivity:assertion];
|
| +
|
| + activity.End();
|
| +
|
| + EXPECT_OCMOCK_VERIFY(processInfoMock);
|
| + [processInfoMock stopMocking];
|
| +}
|
|
|