OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <string> | 5 #include <string> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
104 }; | 104 }; |
105 | 105 |
106 } // namespace | 106 } // namespace |
107 | 107 |
108 TEST(SessionCommandsTest, QuitFails) { | 108 TEST(SessionCommandsTest, QuitFails) { |
109 Session session("id", scoped_ptr<Chrome>(new FailsToQuitChrome())); | 109 Session session("id", scoped_ptr<Chrome>(new FailsToQuitChrome())); |
110 base::DictionaryValue params; | 110 base::DictionaryValue params; |
111 scoped_ptr<base::Value> value; | 111 scoped_ptr<base::Value> value; |
112 ASSERT_EQ(kUnknownError, ExecuteQuit(false, &session, params, &value).code()); | 112 ASSERT_EQ(kUnknownError, ExecuteQuit(false, &session, params, &value).code()); |
113 } | 113 } |
114 | |
115 TEST(SessionCommandsTest, AutoReporting) { | |
116 DetachChrome* chrome = new DetachChrome(); | |
117 Session session("id", scoped_ptr<Chrome>(chrome)); | |
118 base::DictionaryValue params; | |
119 scoped_ptr<base::Value> value; | |
120 StatusCode status; | |
chrisgao (Use stgao instead)
2014/01/09 22:11:55
Rename to |status_code|?
samuong
2014/01/16 00:29:28
Done.
| |
121 bool enabled; | |
122 | |
123 // autoreporting should be disabled by default | |
124 status = ExecuteIsAutoReportingEnabled(&session, params, &value).code(); | |
125 ASSERT_EQ(kOk, status); | |
126 ASSERT_FALSE(session.auto_reporting_enabled); | |
127 value.get()->GetAsBoolean(&enabled); | |
chrisgao (Use stgao instead)
2014/01/09 22:11:55
ASSERT_TRUE?
samuong
2014/01/16 00:29:28
Done.
| |
128 ASSERT_FALSE(enabled); | |
129 | |
130 // an error should be given if the |enable| parameter is not set | |
131 status = ExecuteSetAutoReportingEnabled(&session, params, &value).code(); | |
132 ASSERT_EQ(kUnknownError, status); | |
133 | |
134 // check that autoreporting can be enabled successfully | |
135 params.SetBoolean("enable", true); | |
136 status = ExecuteSetAutoReportingEnabled(&session, params, &value).code(); | |
137 ASSERT_EQ(kOk, status); | |
138 ASSERT_TRUE(session.auto_reporting_enabled); | |
139 value.get()->GetAsBoolean(&enabled); | |
chrisgao (Use stgao instead)
2014/01/09 22:11:55
ASSERT_TRUE?
samuong
2014/01/16 00:29:28
Done.
| |
140 ASSERT_TRUE(enabled); | |
141 | |
142 // check that autoreporting can be disabled successfully | |
143 params.SetBoolean("enable", false); | |
144 status = ExecuteSetAutoReportingEnabled(&session, params, &value).code(); | |
145 ASSERT_EQ(kOk, status); | |
146 ASSERT_FALSE(session.auto_reporting_enabled); | |
147 value.get()->GetAsBoolean(&enabled); | |
chrisgao (Use stgao instead)
2014/01/09 22:11:55
ASSERT_TRUE?
samuong
2014/01/16 00:29:28
Done.
| |
148 ASSERT_FALSE(enabled); | |
149 } | |
OLD | NEW |