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

Unified Diff: chrome/browser/ui/webui/settings/chromeos/easy_unlock_settings_handler_unittest.cc

Issue 1896463003: WebUI: Add JavaScript lifecycle-control to WebUIMessageHandler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/settings/chromeos/easy_unlock_settings_handler_unittest.cc
diff --git a/chrome/browser/ui/webui/settings/chromeos/easy_unlock_settings_handler_unittest.cc b/chrome/browser/ui/webui/settings/chromeos/easy_unlock_settings_handler_unittest.cc
index 01e4f04d6ccd7d91757c086af03dc0957788aaa2..0a013ace57924def4ef2f80f8db5d1eb4d7f7bba 100644
--- a/chrome/browser/ui/webui/settings/chromeos/easy_unlock_settings_handler_unittest.cc
+++ b/chrome/browser/ui/webui/settings/chromeos/easy_unlock_settings_handler_unittest.cc
@@ -196,20 +196,12 @@ TEST_F(EasyUnlockSettingsHandlerTest, EnabledStatus) {
handler.reset(new TestEasyUnlockSettingsHandler(profile()));
handler->set_web_ui(web_ui());
- // Test the C++ -> JS push path.
- handler->SendEnabledStatus();
- VerifyEnabledStatusCallback(1U, false);
-
- fake_easy_unlock_service()->set_is_enabled(true);
- handler->SendEnabledStatus();
- VerifyEnabledStatusCallback(2U, true);
-
// Test the JS -> C++ -> JS callback path.
base::ListValue list_args;
list_args.Append(new base::StringValue("test-callback-id"));
handler->HandleGetEnabledStatus(&list_args);
- EXPECT_EQ(3U, web_ui()->call_data().size());
+ EXPECT_EQ(1U, web_ui()->call_data().size());
const content::TestWebUI::CallData& data = *web_ui()->call_data().back();
EXPECT_EQ("cr.webUIResponse", data.function_name());
@@ -220,7 +212,15 @@ TEST_F(EasyUnlockSettingsHandlerTest, EnabledStatus) {
bool enabled_status = false;
ASSERT_TRUE(data.arg3()->GetAsBoolean(&enabled_status));
- EXPECT_TRUE(enabled_status);
+ EXPECT_FALSE(enabled_status);
+
+ // Test the C++ -> JS push path.
+ handler->SendEnabledStatus();
+ VerifyEnabledStatusCallback(2U, false);
+
+ fake_easy_unlock_service()->set_is_enabled(true);
+ handler->SendEnabledStatus();
+ VerifyEnabledStatusCallback(3U, true);
}
TEST_F(EasyUnlockSettingsHandlerTest, TurnOffFlowStatus) {

Powered by Google App Engine
This is Rietveld 408576698