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

Unified Diff: chrome/test/chromedriver/session_commands_unittest.cc

Issue 101203012: [chromedriver] Add an error autoreporting feature that automatically raises errors from browser logs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 11 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/test/chromedriver/session_commands_unittest.cc
diff --git a/chrome/test/chromedriver/session_commands_unittest.cc b/chrome/test/chromedriver/session_commands_unittest.cc
index e1a2a3682d5ac506a4b1d2052316553a17dc4764..7f15143c647fec0b153fcbe7024dbfd8d27e95e1 100644
--- a/chrome/test/chromedriver/session_commands_unittest.cc
+++ b/chrome/test/chromedriver/session_commands_unittest.cc
@@ -111,3 +111,39 @@ TEST(SessionCommandsTest, QuitFails) {
scoped_ptr<base::Value> value;
ASSERT_EQ(kUnknownError, ExecuteQuit(false, &session, params, &value).code());
}
+
+TEST(SessionCommandsTest, AutoReporting) {
+ DetachChrome* chrome = new DetachChrome();
+ Session session("id", scoped_ptr<Chrome>(chrome));
+ base::DictionaryValue params;
+ scoped_ptr<base::Value> value;
+ StatusCode status;
chrisgao (Use stgao instead) 2014/01/09 22:11:55 Rename to |status_code|?
samuong 2014/01/16 00:29:28 Done.
+ bool enabled;
+
+ // autoreporting should be disabled by default
+ status = ExecuteIsAutoReportingEnabled(&session, params, &value).code();
+ ASSERT_EQ(kOk, status);
+ ASSERT_FALSE(session.auto_reporting_enabled);
+ value.get()->GetAsBoolean(&enabled);
chrisgao (Use stgao instead) 2014/01/09 22:11:55 ASSERT_TRUE?
samuong 2014/01/16 00:29:28 Done.
+ ASSERT_FALSE(enabled);
+
+ // an error should be given if the |enable| parameter is not set
+ status = ExecuteSetAutoReportingEnabled(&session, params, &value).code();
+ ASSERT_EQ(kUnknownError, status);
+
+ // check that autoreporting can be enabled successfully
+ params.SetBoolean("enable", true);
+ status = ExecuteSetAutoReportingEnabled(&session, params, &value).code();
+ ASSERT_EQ(kOk, status);
+ ASSERT_TRUE(session.auto_reporting_enabled);
+ value.get()->GetAsBoolean(&enabled);
chrisgao (Use stgao instead) 2014/01/09 22:11:55 ASSERT_TRUE?
samuong 2014/01/16 00:29:28 Done.
+ ASSERT_TRUE(enabled);
+
+ // check that autoreporting can be disabled successfully
+ params.SetBoolean("enable", false);
+ status = ExecuteSetAutoReportingEnabled(&session, params, &value).code();
+ ASSERT_EQ(kOk, status);
+ ASSERT_FALSE(session.auto_reporting_enabled);
+ value.get()->GetAsBoolean(&enabled);
chrisgao (Use stgao instead) 2014/01/09 22:11:55 ASSERT_TRUE?
samuong 2014/01/16 00:29:28 Done.
+ ASSERT_FALSE(enabled);
+}

Powered by Google App Engine
This is Rietveld 408576698