| 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 "components/mus/public/cpp/window.h" | 5 #include "components/mus/public/cpp/window.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "components/mus/public/cpp/lib/window_private.h" | 9 #include "components/mus/public/cpp/lib/window_private.h" |
| 10 #include "components/mus/public/cpp/property_type_converters.h" | 10 #include "components/mus/public/cpp/property_type_converters.h" |
| 11 #include "components/mus/public/cpp/tests/test_window.h" |
| 11 #include "components/mus/public/cpp/util.h" | 12 #include "components/mus/public/cpp/util.h" |
| 12 #include "components/mus/public/cpp/window_observer.h" | 13 #include "components/mus/public/cpp/window_observer.h" |
| 13 #include "components/mus/public/cpp/window_property.h" | 14 #include "components/mus/public/cpp/window_property.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 15 #include "ui/gfx/geometry/rect.h" | 16 #include "ui/gfx/geometry/rect.h" |
| 16 | 17 |
| 17 namespace mus { | 18 namespace mus { |
| 18 | 19 |
| 19 // Window --------------------------------------------------------------------- | 20 // Window --------------------------------------------------------------------- |
| 20 | 21 |
| 21 typedef testing::Test WindowTest; | 22 using WindowTest = testing::Test; |
| 22 | |
| 23 // Subclass with public ctor/dtor. | |
| 24 class TestWindow : public Window { | |
| 25 public: | |
| 26 TestWindow() { WindowPrivate(this).set_id(1); } | |
| 27 ~TestWindow() {} | |
| 28 | |
| 29 private: | |
| 30 MOJO_DISALLOW_COPY_AND_ASSIGN(TestWindow); | |
| 31 }; | |
| 32 | 23 |
| 33 TEST_F(WindowTest, AddChild) { | 24 TEST_F(WindowTest, AddChild) { |
| 34 TestWindow w1; | 25 TestWindow w1; |
| 35 TestWindow w11; | 26 TestWindow w11; |
| 36 w1.AddChild(&w11); | 27 w1.AddChild(&w11); |
| 37 EXPECT_EQ(1U, w1.children().size()); | 28 EXPECT_EQ(1U, w1.children().size()); |
| 38 } | 29 } |
| 39 | 30 |
| 40 TEST_F(WindowTest, RemoveChild) { | 31 TEST_F(WindowTest, RemoveChild) { |
| 41 TestWindow w1; | 32 TestWindow w1; |
| (...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 873 EXPECT_EQ(PropertyChangeInfo(&prop, -2), o.PropertyChangeInfoAndClear()); | 864 EXPECT_EQ(PropertyChangeInfo(&prop, -2), o.PropertyChangeInfoAndClear()); |
| 874 w1.ClearLocalProperty(&prop); | 865 w1.ClearLocalProperty(&prop); |
| 875 EXPECT_EQ(PropertyChangeInfo(&prop, 3), o.PropertyChangeInfoAndClear()); | 866 EXPECT_EQ(PropertyChangeInfo(&prop, 3), o.PropertyChangeInfoAndClear()); |
| 876 | 867 |
| 877 // Sanity check to see if |PropertyChangeInfoAndClear| really clears. | 868 // Sanity check to see if |PropertyChangeInfoAndClear| really clears. |
| 878 EXPECT_EQ(PropertyChangeInfo(reinterpret_cast<const void*>(NULL), -3), | 869 EXPECT_EQ(PropertyChangeInfo(reinterpret_cast<const void*>(NULL), -3), |
| 879 o.PropertyChangeInfoAndClear()); | 870 o.PropertyChangeInfoAndClear()); |
| 880 } | 871 } |
| 881 | 872 |
| 882 } // namespace mus | 873 } // namespace mus |
| OLD | NEW |