| 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/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 } | 43 } |
| 44 | 44 |
| 45 namespace { | 45 namespace { |
| 46 | 46 |
| 47 class DetachChrome : public StubChrome { | 47 class DetachChrome : public StubChrome { |
| 48 public: | 48 public: |
| 49 DetachChrome() : quit_called_(false) {} | 49 DetachChrome() : quit_called_(false) {} |
| 50 virtual ~DetachChrome() {} | 50 virtual ~DetachChrome() {} |
| 51 | 51 |
| 52 // Overridden from Chrome: | 52 // Overridden from Chrome: |
| 53 virtual Status Quit() OVERRIDE { | 53 virtual Status Quit() override { |
| 54 quit_called_ = true; | 54 quit_called_ = true; |
| 55 return Status(kOk); | 55 return Status(kOk); |
| 56 } | 56 } |
| 57 | 57 |
| 58 bool quit_called_; | 58 bool quit_called_; |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 } // namespace | 61 } // namespace |
| 62 | 62 |
| 63 TEST(SessionCommandsTest, Quit) { | 63 TEST(SessionCommandsTest, Quit) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 91 } | 91 } |
| 92 | 92 |
| 93 namespace { | 93 namespace { |
| 94 | 94 |
| 95 class FailsToQuitChrome : public StubChrome { | 95 class FailsToQuitChrome : public StubChrome { |
| 96 public: | 96 public: |
| 97 FailsToQuitChrome() {} | 97 FailsToQuitChrome() {} |
| 98 virtual ~FailsToQuitChrome() {} | 98 virtual ~FailsToQuitChrome() {} |
| 99 | 99 |
| 100 // Overridden from Chrome: | 100 // Overridden from Chrome: |
| 101 virtual Status Quit() OVERRIDE { | 101 virtual Status Quit() override { |
| 102 return Status(kUnknownError); | 102 return Status(kUnknownError); |
| 103 } | 103 } |
| 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; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 status_code = ExecuteSetAutoReporting(&session, params, &value).code(); | 148 status_code = ExecuteSetAutoReporting(&session, params, &value).code(); |
| 149 ASSERT_EQ(kOk, status_code); | 149 ASSERT_EQ(kOk, status_code); |
| 150 ASSERT_FALSE(session.auto_reporting_enabled); | 150 ASSERT_FALSE(session.auto_reporting_enabled); |
| 151 | 151 |
| 152 // check that autoreporting was disabled successfully | 152 // check that autoreporting was disabled successfully |
| 153 status_code = ExecuteIsAutoReporting(&session, params, &value).code(); | 153 status_code = ExecuteIsAutoReporting(&session, params, &value).code(); |
| 154 ASSERT_EQ(kOk, status_code); | 154 ASSERT_EQ(kOk, status_code); |
| 155 ASSERT_TRUE(value.get()->GetAsBoolean(&enabled)); | 155 ASSERT_TRUE(value.get()->GetAsBoolean(&enabled)); |
| 156 ASSERT_FALSE(enabled); | 156 ASSERT_FALSE(enabled); |
| 157 } | 157 } |
| OLD | NEW |