Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Side by Side Diff: content/common/mac/app_nap_activity_unittest.mm

Issue 2913883002: [Mac] Wrap NSUserActivity begin/end so that it can be called from common files (Closed)
Patch Set: Whitespace Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/common/mac/app_nap_activity.mm ('k') | content/test/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/common/mac/app_nap_activity.h"
6
7 #include "testing/gtest_mac.h"
8 #include "testing/platform_test.h"
9 #import "third_party/ocmock/OCMock/OCMock.h"
10 #include "third_party/ocmock/gtest_support.h"
11
12 class AppNapActivityTest : public PlatformTest {};
13
14 TEST_F(AppNapActivityTest, StoresAssertion) {
15 const NSActivityOptions expectedOptions =
16 (NSActivityUserInitiatedAllowingIdleSystemSleep |
17 NSActivityLatencyCritical) &
18 ~(NSActivitySuddenTerminationDisabled |
19 NSActivityAutomaticTerminationDisabled);
20 id processInfoMock =
21 [OCMockObject partialMockForObject:[NSProcessInfo processInfo]];
22 id assertion = @"An activity assertion";
23 [[[processInfoMock expect] andReturn:assertion]
24 beginActivityWithOptions:expectedOptions
25 reason:OCMOCK_ANY];
26
27 content::AppNapActivity activity;
28 activity.Begin();
29
30 EXPECT_OCMOCK_VERIFY(processInfoMock);
31
32 [[processInfoMock expect] endActivity:assertion];
33
34 activity.End();
35
36 EXPECT_OCMOCK_VERIFY(processInfoMock);
37 [processInfoMock stopMocking];
38 }
OLDNEW
« no previous file with comments | « content/common/mac/app_nap_activity.mm ('k') | content/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698