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/macros.h" |
5 #include "mojo/bindings/js/handle.h" | 6 #include "mojo/bindings/js/handle.h" |
6 #include "mojo/bindings/js/handle_close_observer.h" | 7 #include "mojo/bindings/js/handle_close_observer.h" |
7 #include "mojo/public/cpp/system/core.h" | 8 #include "mojo/public/cpp/system/core.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
9 | 10 |
10 namespace mojo { | 11 namespace mojo { |
11 namespace js { | 12 namespace js { |
12 | 13 |
13 class HandleWrapperTest : public testing::Test, | 14 class HandleWrapperTest : public testing::Test, |
14 public gin::HandleCloseObserver { | 15 public gin::HandleCloseObserver { |
15 public: | 16 public: |
16 HandleWrapperTest() : closes_observed_(0) {} | 17 HandleWrapperTest() : closes_observed_(0) {} |
17 | 18 |
18 virtual void OnWillCloseHandle() OVERRIDE { closes_observed_++; } | 19 virtual void OnWillCloseHandle() override { closes_observed_++; } |
19 | 20 |
20 protected: | 21 protected: |
21 int closes_observed_; | 22 int closes_observed_; |
22 | 23 |
23 private: | 24 private: |
24 DISALLOW_COPY_AND_ASSIGN(HandleWrapperTest); | 25 DISALLOW_COPY_AND_ASSIGN(HandleWrapperTest); |
25 }; | 26 }; |
26 | 27 |
27 class TestHandleWrapper : public gin::HandleWrapper { | 28 class TestHandleWrapper : public gin::HandleWrapper { |
28 public: | 29 public: |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 mojo::MessagePipe pipe; | 81 mojo::MessagePipe pipe; |
81 TestHandleWrapper wrapper(pipe.handle0.release().value()); | 82 TestHandleWrapper wrapper(pipe.handle0.release().value()); |
82 wrapper.AddCloseObserver(this); | 83 wrapper.AddCloseObserver(this); |
83 ASSERT_EQ(0, closes_observed_); | 84 ASSERT_EQ(0, closes_observed_); |
84 } | 85 } |
85 EXPECT_EQ(1, closes_observed_); | 86 EXPECT_EQ(1, closes_observed_); |
86 } | 87 } |
87 | 88 |
88 } // namespace js | 89 } // namespace js |
89 } // namespace mojo | 90 } // namespace mojo |
OLD | NEW |