Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: mojo/apps/js/test/handle_unittest.cc

Issue 651523002: [Mojo] Fix the namespace for HandleWrapper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | mojo/bindings/js/core.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/macros.h"
6 #include "mojo/bindings/js/handle.h" 6 #include "mojo/bindings/js/handle.h"
7 #include "mojo/bindings/js/handle_close_observer.h" 7 #include "mojo/bindings/js/handle_close_observer.h"
8 #include "mojo/public/cpp/system/core.h" 8 #include "mojo/public/cpp/system/core.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 namespace mojo { 11 namespace mojo {
12 namespace js { 12 namespace js {
13 13
14 class HandleWrapperTest : public testing::Test, 14 class HandleWrapperTest : public testing::Test,
15 public gin::HandleCloseObserver { 15 public HandleCloseObserver {
16 public: 16 public:
17 HandleWrapperTest() : closes_observed_(0) {} 17 HandleWrapperTest() : closes_observed_(0) {}
18 18
19 virtual void OnWillCloseHandle() override { closes_observed_++; } 19 virtual void OnWillCloseHandle() override { closes_observed_++; }
20 20
21 protected: 21 protected:
22 int closes_observed_; 22 int closes_observed_;
23 23
24 private: 24 private:
25 DISALLOW_COPY_AND_ASSIGN(HandleWrapperTest); 25 DISALLOW_COPY_AND_ASSIGN(HandleWrapperTest);
26 }; 26 };
27 27
28 class TestHandleWrapper : public gin::HandleWrapper { 28 class TestHandleWrapper : public HandleWrapper {
29 public: 29 public:
30 explicit TestHandleWrapper(MojoHandle handle) : HandleWrapper(handle) {} 30 explicit TestHandleWrapper(MojoHandle handle) : HandleWrapper(handle) {}
31 31
32 private: 32 private:
33 DISALLOW_COPY_AND_ASSIGN(TestHandleWrapper); 33 DISALLOW_COPY_AND_ASSIGN(TestHandleWrapper);
34 }; 34 };
35 35
36 // Test that calling Close() on a HandleWrapper for an invalid handle does not 36 // Test that calling Close() on a HandleWrapper for an invalid handle does not
37 // notify observers. 37 // notify observers.
38 TEST_F(HandleWrapperTest, CloseWithInvalidHandle) { 38 TEST_F(HandleWrapperTest, CloseWithInvalidHandle) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 mojo::MessagePipe pipe; 81 mojo::MessagePipe pipe;
82 TestHandleWrapper wrapper(pipe.handle0.release().value()); 82 TestHandleWrapper wrapper(pipe.handle0.release().value());
83 wrapper.AddCloseObserver(this); 83 wrapper.AddCloseObserver(this);
84 ASSERT_EQ(0, closes_observed_); 84 ASSERT_EQ(0, closes_observed_);
85 } 85 }
86 EXPECT_EQ(1, closes_observed_); 86 EXPECT_EQ(1, closes_observed_);
87 } 87 }
88 88
89 } // namespace js 89 } // namespace js
90 } // namespace mojo 90 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | mojo/bindings/js/core.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698