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

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: Address comments from review 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
« no previous file with comments | « chrome/test/chromedriver/session_commands.cc ('k') | chrome/test/chromedriver/test/run_py_tests.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..e33439b9f18bbcd65edbc60625be878d424da00d 100644
--- a/chrome/test/chromedriver/session_commands_unittest.cc
+++ b/chrome/test/chromedriver/session_commands_unittest.cc
@@ -111,3 +111,47 @@ 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_code;
+ bool enabled;
+
+ // autoreporting should be disabled by default
+ status_code = ExecuteIsAutoReporting(&session, params, &value).code();
+ ASSERT_EQ(kOk, status_code);
+ ASSERT_FALSE(session.auto_reporting_enabled);
+ ASSERT_TRUE(value.get()->GetAsBoolean(&enabled));
+ ASSERT_FALSE(enabled);
+
+ // an error should be given if the |enabled| parameter is not set
+ status_code = ExecuteSetAutoReporting(&session, params, &value).code();
+ ASSERT_EQ(kUnknownError, status_code);
+
+ // try to enable autoreporting
+ params.SetBoolean("enabled", true);
+ status_code = ExecuteSetAutoReporting(&session, params, &value).code();
+ ASSERT_EQ(kOk, status_code);
+ ASSERT_TRUE(session.auto_reporting_enabled);
+
+ // check that autoreporting was enabled successfully
+ status_code = ExecuteIsAutoReporting(&session, params, &value).code();
+ ASSERT_EQ(kOk, status_code);
+ ASSERT_TRUE(value.get()->GetAsBoolean(&enabled));
+ ASSERT_TRUE(enabled);
+
+ // try to disable autoreporting
+ params.SetBoolean("enabled", false);
+ status_code = ExecuteSetAutoReporting(&session, params, &value).code();
+ ASSERT_EQ(kOk, status_code);
+ ASSERT_FALSE(session.auto_reporting_enabled);
+
+ // check that autoreporting was disabled successfully
+ status_code = ExecuteIsAutoReporting(&session, params, &value).code();
+ ASSERT_EQ(kOk, status_code);
+ ASSERT_TRUE(value.get()->GetAsBoolean(&enabled));
+ ASSERT_FALSE(enabled);
+}
« no previous file with comments | « chrome/test/chromedriver/session_commands.cc ('k') | chrome/test/chromedriver/test/run_py_tests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698