Chromium Code Reviews| 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); |
| +} |