| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/json/json_writer.h" | 5 #include "base/json/json_writer.h" |
| 6 #include "base/values.h" | 6 #include "base/values.h" |
| 7 #include "chrome/browser/extensions/api/copresence/copresence_api.h" | 7 #include "chrome/browser/extensions/api/copresence/copresence_api.h" |
| 8 #include "chrome/browser/extensions/extension_api_unittest.h" | 8 #include "chrome/browser/extensions/extension_api_unittest.h" |
| 9 #include "chrome/browser/extensions/extension_function_test_utils.h" | 9 #include "chrome/browser/extensions/extension_function_test_utils.h" |
| 10 #include "components/copresence/proto/data.pb.h" | 10 #include "components/copresence/proto/data.pb.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 return false; | 64 return false; |
| 65 | 65 |
| 66 *out = things.Get(0); | 66 *out = things.Get(0); |
| 67 return true; | 67 return true; |
| 68 } | 68 } |
| 69 | 69 |
| 70 class MockCopresenceManager : public CopresenceManager { | 70 class MockCopresenceManager : public CopresenceManager { |
| 71 public: | 71 public: |
| 72 explicit MockCopresenceManager(CopresenceDelegate* delegate) | 72 explicit MockCopresenceManager(CopresenceDelegate* delegate) |
| 73 : delegate_(delegate) {} | 73 : delegate_(delegate) {} |
| 74 virtual ~MockCopresenceManager() {} | 74 ~MockCopresenceManager() override {} |
| 75 | 75 |
| 76 virtual void ExecuteReportRequest( | 76 void ExecuteReportRequest( |
| 77 ReportRequest request, | 77 ReportRequest request, |
| 78 const std::string& app_id, | 78 const std::string& app_id, |
| 79 const copresence::StatusCallback& status_callback) override { | 79 const copresence::StatusCallback& status_callback) override { |
| 80 request_ = request; | 80 request_ = request; |
| 81 app_id_ = app_id; | 81 app_id_ = app_id; |
| 82 status_callback.Run(copresence::SUCCESS); | 82 status_callback.Run(copresence::SUCCESS); |
| 83 } | 83 } |
| 84 | 84 |
| 85 CopresenceDelegate* delegate_; | 85 CopresenceDelegate* delegate_; |
| 86 | 86 |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 | 264 |
| 265 TEST_F(CopresenceApiUnittest, MultipleOperations) { | 265 TEST_F(CopresenceApiUnittest, MultipleOperations) { |
| 266 scoped_ptr<Operation> multi_operation(new Operation); | 266 scoped_ptr<Operation> multi_operation(new Operation); |
| 267 multi_operation->publish.reset(CreatePublish("pub")); | 267 multi_operation->publish.reset(CreatePublish("pub")); |
| 268 multi_operation->subscribe.reset(CreateSubscribe("sub")); | 268 multi_operation->subscribe.reset(CreateSubscribe("sub")); |
| 269 | 269 |
| 270 EXPECT_FALSE(ExecuteOperation(multi_operation.Pass())); | 270 EXPECT_FALSE(ExecuteOperation(multi_operation.Pass())); |
| 271 } | 271 } |
| 272 | 272 |
| 273 } // namespace extensions | 273 } // namespace extensions |
| OLD | NEW |