Commit 11b9a8a9 authored by Sam Goto's avatar Sam Goto Committed by Commit Bot

[idle] Rename enum values from CONSTANT to kConstant

Bug: 878979
Change-Id: Ie96867d4f6bc1415d8ffb5f1f43e93d0364043e2
Reviewed-on: https://chromium-review.googlesource.com/c/1492430
Commit-Queue: Sam Goto <goto@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarReilly Grant <reillyg@chromium.org>
Auto-Submit: Sam Goto <goto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#636502}
parent 66d74710
...@@ -43,15 +43,15 @@ blink::mojom::IdleStatePtr IdleTimeToIdleState(bool locked, ...@@ -43,15 +43,15 @@ blink::mojom::IdleStatePtr IdleTimeToIdleState(bool locked,
int idle_threshold) { int idle_threshold) {
blink::mojom::UserIdleState user; blink::mojom::UserIdleState user;
if (idle_time >= idle_threshold) if (idle_time >= idle_threshold)
user = blink::mojom::UserIdleState::IDLE; user = blink::mojom::UserIdleState::kIdle;
else else
user = blink::mojom::UserIdleState::ACTIVE; user = blink::mojom::UserIdleState::kActive;
blink::mojom::ScreenIdleState screen; blink::mojom::ScreenIdleState screen;
if (locked) if (locked)
screen = blink::mojom::ScreenIdleState::LOCKED; screen = blink::mojom::ScreenIdleState::kLocked;
else else
screen = blink::mojom::ScreenIdleState::UNLOCKED; screen = blink::mojom::ScreenIdleState::kUnlocked;
return blink::mojom::IdleState::New(user, screen); return blink::mojom::IdleState::New(user, screen);
} }
......
...@@ -99,8 +99,8 @@ TEST_F(IdleManagerTest, AddMonitor) { ...@@ -99,8 +99,8 @@ TEST_F(IdleManagerTest, AddMonitor) {
base::BindOnce( base::BindOnce(
[](base::OnceClosure callback, blink::mojom::IdleStatePtr state) { [](base::OnceClosure callback, blink::mojom::IdleStatePtr state) {
// The initial state of the status of the user is to be active. // The initial state of the status of the user is to be active.
EXPECT_EQ(blink::mojom::UserIdleState::ACTIVE, state->user); EXPECT_EQ(blink::mojom::UserIdleState::kActive, state->user);
EXPECT_EQ(blink::mojom::ScreenIdleState::UNLOCKED, state->screen); EXPECT_EQ(blink::mojom::ScreenIdleState::kUnlocked, state->screen);
std::move(callback).Run(); std::move(callback).Run();
}, },
loop.QuitClosure())); loop.QuitClosure()));
...@@ -133,7 +133,7 @@ TEST_F(IdleManagerTest, Idle) { ...@@ -133,7 +133,7 @@ TEST_F(IdleManagerTest, Idle) {
service_ptr->AddMonitor( service_ptr->AddMonitor(
kTresholdInSecs, std::move(monitor_ptr), kTresholdInSecs, std::move(monitor_ptr),
base::BindLambdaForTesting([&](blink::mojom::IdleStatePtr state) { base::BindLambdaForTesting([&](blink::mojom::IdleStatePtr state) {
EXPECT_EQ(blink::mojom::UserIdleState::ACTIVE, state->user); EXPECT_EQ(blink::mojom::UserIdleState::kActive, state->user);
loop.Quit(); loop.Quit();
})); }));
...@@ -148,7 +148,7 @@ TEST_F(IdleManagerTest, Idle) { ...@@ -148,7 +148,7 @@ TEST_F(IdleManagerTest, Idle) {
// Expects Update to be notified about the change to idle. // Expects Update to be notified about the change to idle.
EXPECT_CALL(monitor, Update(_)) EXPECT_CALL(monitor, Update(_))
.WillOnce(Invoke([&](blink::mojom::IdleStatePtr state) { .WillOnce(Invoke([&](blink::mojom::IdleStatePtr state) {
EXPECT_EQ(blink::mojom::UserIdleState::IDLE, state->user); EXPECT_EQ(blink::mojom::UserIdleState::kIdle, state->user);
loop.Quit(); loop.Quit();
})); }));
loop.Run(); loop.Run();
...@@ -163,7 +163,7 @@ TEST_F(IdleManagerTest, Idle) { ...@@ -163,7 +163,7 @@ TEST_F(IdleManagerTest, Idle) {
// auto quit = loop.QuitClosure(); // auto quit = loop.QuitClosure();
EXPECT_CALL(monitor, Update(_)) EXPECT_CALL(monitor, Update(_))
.WillOnce(Invoke([&](blink::mojom::IdleStatePtr state) { .WillOnce(Invoke([&](blink::mojom::IdleStatePtr state) {
EXPECT_EQ(blink::mojom::UserIdleState::ACTIVE, state->user); EXPECT_EQ(blink::mojom::UserIdleState::kActive, state->user);
// Ends the test. // Ends the test.
loop.Quit(); loop.Quit();
})); }));
...@@ -198,7 +198,7 @@ TEST_F(IdleManagerTest, UnlockingScreen) { ...@@ -198,7 +198,7 @@ TEST_F(IdleManagerTest, UnlockingScreen) {
service_ptr->AddMonitor( service_ptr->AddMonitor(
kTresholdInSecs, std::move(monitor_ptr), kTresholdInSecs, std::move(monitor_ptr),
base::BindLambdaForTesting([&](blink::mojom::IdleStatePtr state) { base::BindLambdaForTesting([&](blink::mojom::IdleStatePtr state) {
EXPECT_EQ(blink::mojom::ScreenIdleState::LOCKED, state->screen); EXPECT_EQ(blink::mojom::ScreenIdleState::kLocked, state->screen);
loop.Quit(); loop.Quit();
})); }));
...@@ -215,7 +215,7 @@ TEST_F(IdleManagerTest, UnlockingScreen) { ...@@ -215,7 +215,7 @@ TEST_F(IdleManagerTest, UnlockingScreen) {
// Expects Update to be notified about the change to unlocked. // Expects Update to be notified about the change to unlocked.
EXPECT_CALL(monitor, Update(_)) EXPECT_CALL(monitor, Update(_))
.WillOnce(Invoke([&](blink::mojom::IdleStatePtr state) { .WillOnce(Invoke([&](blink::mojom::IdleStatePtr state) {
EXPECT_EQ(blink::mojom::ScreenIdleState::UNLOCKED, state->screen); EXPECT_EQ(blink::mojom::ScreenIdleState::kUnlocked, state->screen);
loop.Quit(); loop.Quit();
})); }));
...@@ -250,7 +250,7 @@ TEST_F(IdleManagerTest, LockingScreen) { ...@@ -250,7 +250,7 @@ TEST_F(IdleManagerTest, LockingScreen) {
service_ptr->AddMonitor( service_ptr->AddMonitor(
kTresholdInSecs, std::move(monitor_ptr), kTresholdInSecs, std::move(monitor_ptr),
base::BindLambdaForTesting([&](blink::mojom::IdleStatePtr state) { base::BindLambdaForTesting([&](blink::mojom::IdleStatePtr state) {
EXPECT_EQ(blink::mojom::ScreenIdleState::UNLOCKED, state->screen); EXPECT_EQ(blink::mojom::ScreenIdleState::kUnlocked, state->screen);
loop.Quit(); loop.Quit();
})); }));
...@@ -267,7 +267,7 @@ TEST_F(IdleManagerTest, LockingScreen) { ...@@ -267,7 +267,7 @@ TEST_F(IdleManagerTest, LockingScreen) {
// Expects Update to be notified about the change to unlocked. // Expects Update to be notified about the change to unlocked.
EXPECT_CALL(monitor, Update(_)) EXPECT_CALL(monitor, Update(_))
.WillOnce(Invoke([&](blink::mojom::IdleStatePtr state) { .WillOnce(Invoke([&](blink::mojom::IdleStatePtr state) {
EXPECT_EQ(blink::mojom::ScreenIdleState::LOCKED, state->screen); EXPECT_EQ(blink::mojom::ScreenIdleState::kLocked, state->screen);
loop.Quit(); loop.Quit();
})); }));
...@@ -302,8 +302,8 @@ TEST_F(IdleManagerTest, LockingScreenThenIdle) { ...@@ -302,8 +302,8 @@ TEST_F(IdleManagerTest, LockingScreenThenIdle) {
service_ptr->AddMonitor( service_ptr->AddMonitor(
kTresholdInSecs, std::move(monitor_ptr), kTresholdInSecs, std::move(monitor_ptr),
base::BindLambdaForTesting([&](blink::mojom::IdleStatePtr state) { base::BindLambdaForTesting([&](blink::mojom::IdleStatePtr state) {
EXPECT_EQ(blink::mojom::UserIdleState::ACTIVE, state->user); EXPECT_EQ(blink::mojom::UserIdleState::kActive, state->user);
EXPECT_EQ(blink::mojom::ScreenIdleState::UNLOCKED, state->screen); EXPECT_EQ(blink::mojom::ScreenIdleState::kUnlocked, state->screen);
loop.Quit(); loop.Quit();
})); }));
...@@ -320,8 +320,8 @@ TEST_F(IdleManagerTest, LockingScreenThenIdle) { ...@@ -320,8 +320,8 @@ TEST_F(IdleManagerTest, LockingScreenThenIdle) {
// Expects Update to be notified about the change to locked. // Expects Update to be notified about the change to locked.
EXPECT_CALL(monitor, Update(_)) EXPECT_CALL(monitor, Update(_))
.WillOnce(Invoke([&](blink::mojom::IdleStatePtr state) { .WillOnce(Invoke([&](blink::mojom::IdleStatePtr state) {
EXPECT_EQ(blink::mojom::ScreenIdleState::LOCKED, state->screen); EXPECT_EQ(blink::mojom::ScreenIdleState::kLocked, state->screen);
EXPECT_EQ(blink::mojom::UserIdleState::ACTIVE, state->user); EXPECT_EQ(blink::mojom::UserIdleState::kActive, state->user);
loop.Quit(); loop.Quit();
})); }));
...@@ -339,8 +339,8 @@ TEST_F(IdleManagerTest, LockingScreenThenIdle) { ...@@ -339,8 +339,8 @@ TEST_F(IdleManagerTest, LockingScreenThenIdle) {
// Expects Update to be notified about the change to active. // Expects Update to be notified about the change to active.
EXPECT_CALL(monitor, Update(_)) EXPECT_CALL(monitor, Update(_))
.WillOnce(Invoke([&](blink::mojom::IdleStatePtr state) { .WillOnce(Invoke([&](blink::mojom::IdleStatePtr state) {
EXPECT_EQ(blink::mojom::UserIdleState::IDLE, state->user); EXPECT_EQ(blink::mojom::UserIdleState::kIdle, state->user);
EXPECT_EQ(blink::mojom::ScreenIdleState::LOCKED, state->screen); EXPECT_EQ(blink::mojom::ScreenIdleState::kLocked, state->screen);
// Ends the test. // Ends the test.
loop.Quit(); loop.Quit();
})); }));
...@@ -377,8 +377,8 @@ TEST_F(IdleManagerTest, LockingScreenAfterIdle) { ...@@ -377,8 +377,8 @@ TEST_F(IdleManagerTest, LockingScreenAfterIdle) {
service_ptr->AddMonitor( service_ptr->AddMonitor(
kTresholdInSecs, std::move(monitor_ptr), kTresholdInSecs, std::move(monitor_ptr),
base::BindLambdaForTesting([&](blink::mojom::IdleStatePtr state) { base::BindLambdaForTesting([&](blink::mojom::IdleStatePtr state) {
EXPECT_EQ(blink::mojom::UserIdleState::ACTIVE, state->user); EXPECT_EQ(blink::mojom::UserIdleState::kActive, state->user);
EXPECT_EQ(blink::mojom::ScreenIdleState::UNLOCKED, state->screen); EXPECT_EQ(blink::mojom::ScreenIdleState::kUnlocked, state->screen);
loop.Quit(); loop.Quit();
})); }));
...@@ -395,8 +395,8 @@ TEST_F(IdleManagerTest, LockingScreenAfterIdle) { ...@@ -395,8 +395,8 @@ TEST_F(IdleManagerTest, LockingScreenAfterIdle) {
// Expects Update to be notified about the change to idle. // Expects Update to be notified about the change to idle.
EXPECT_CALL(monitor, Update(_)) EXPECT_CALL(monitor, Update(_))
.WillOnce(Invoke([&](blink::mojom::IdleStatePtr state) { .WillOnce(Invoke([&](blink::mojom::IdleStatePtr state) {
EXPECT_EQ(blink::mojom::UserIdleState::IDLE, state->user); EXPECT_EQ(blink::mojom::UserIdleState::kIdle, state->user);
EXPECT_EQ(blink::mojom::ScreenIdleState::UNLOCKED, state->screen); EXPECT_EQ(blink::mojom::ScreenIdleState::kUnlocked, state->screen);
loop.Quit(); loop.Quit();
})); }));
...@@ -415,8 +415,8 @@ TEST_F(IdleManagerTest, LockingScreenAfterIdle) { ...@@ -415,8 +415,8 @@ TEST_F(IdleManagerTest, LockingScreenAfterIdle) {
// Expects Update to be notified about the change to locked. // Expects Update to be notified about the change to locked.
EXPECT_CALL(monitor, Update(_)) EXPECT_CALL(monitor, Update(_))
.WillOnce(Invoke([&](blink::mojom::IdleStatePtr state) { .WillOnce(Invoke([&](blink::mojom::IdleStatePtr state) {
EXPECT_EQ(blink::mojom::ScreenIdleState::LOCKED, state->screen); EXPECT_EQ(blink::mojom::ScreenIdleState::kLocked, state->screen);
EXPECT_EQ(blink::mojom::UserIdleState::IDLE, state->user); EXPECT_EQ(blink::mojom::UserIdleState::kIdle, state->user);
// Ends the test. // Ends the test.
loop.Quit(); loop.Quit();
})); }));
...@@ -493,7 +493,7 @@ TEST_F(IdleManagerTest, Threshold) { ...@@ -493,7 +493,7 @@ TEST_F(IdleManagerTest, Threshold) {
service_ptr->AddMonitor( service_ptr->AddMonitor(
5, std::move(monitor_ptr), 5, std::move(monitor_ptr),
base::BindLambdaForTesting([&](blink::mojom::IdleStatePtr state) { base::BindLambdaForTesting([&](blink::mojom::IdleStatePtr state) {
EXPECT_EQ(blink::mojom::UserIdleState::IDLE, state->user); EXPECT_EQ(blink::mojom::UserIdleState::kIdle, state->user);
loop.Quit(); loop.Quit();
})); }));
......
...@@ -9,13 +9,13 @@ module blink.mojom; ...@@ -9,13 +9,13 @@ module blink.mojom;
// Proposal: https://github.com/inexorabletash/idle-detection // Proposal: https://github.com/inexorabletash/idle-detection
enum UserIdleState { enum UserIdleState {
ACTIVE, kActive,
IDLE kIdle
}; };
enum ScreenIdleState { enum ScreenIdleState {
LOCKED, kLocked,
UNLOCKED kUnlocked
}; };
struct IdleState { struct IdleState {
......
...@@ -24,18 +24,18 @@ const mojom::blink::IdleState IdleState::state() const { ...@@ -24,18 +24,18 @@ const mojom::blink::IdleState IdleState::state() const {
String IdleState::user() const { String IdleState::user() const {
switch (state_->user) { switch (state_->user) {
case mojom::blink::UserIdleState::ACTIVE: case mojom::blink::UserIdleState::kActive:
return "active"; return "active";
case mojom::blink::UserIdleState::IDLE: case mojom::blink::UserIdleState::kIdle:
return "idle"; return "idle";
} }
} }
String IdleState::screen() const { String IdleState::screen() const {
switch (state_->screen) { switch (state_->screen) {
case mojom::blink::ScreenIdleState::LOCKED: case mojom::blink::ScreenIdleState::kLocked:
return "locked"; return "locked";
case mojom::blink::ScreenIdleState::UNLOCKED: case mojom::blink::ScreenIdleState::kUnlocked:
return "unlocked"; return "unlocked";
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment