OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 3413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3424 EXPECT_EQ(NULL, v1.GetViewByID(kV5ID)); // No V5 exists. | 3424 EXPECT_EQ(NULL, v1.GetViewByID(kV5ID)); // No V5 exists. |
3425 EXPECT_EQ(NULL, v2.GetViewByID(kV1ID)); // It can get only from child views. | 3425 EXPECT_EQ(NULL, v2.GetViewByID(kV1ID)); // It can get only from child views. |
3426 | 3426 |
3427 const int kGroup = 1; | 3427 const int kGroup = 1; |
3428 v3.SetGroup(kGroup); | 3428 v3.SetGroup(kGroup); |
3429 v4.SetGroup(kGroup); | 3429 v4.SetGroup(kGroup); |
3430 | 3430 |
3431 View::Views views; | 3431 View::Views views; |
3432 v1.GetViewsInGroup(kGroup, &views); | 3432 v1.GetViewsInGroup(kGroup, &views); |
3433 EXPECT_EQ(2U, views.size()); | 3433 EXPECT_EQ(2U, views.size()); |
3434 | 3434 EXPECT_NE(views.cend(), std::find(views.cbegin(), views.cend(), &v3)); |
3435 View::Views::const_iterator i(std::find(views.begin(), views.end(), &v3)); | 3435 EXPECT_NE(views.cend(), std::find(views.cbegin(), views.cend(), &v4)); |
3436 EXPECT_NE(views.end(), i); | |
3437 | |
3438 i = std::find(views.begin(), views.end(), &v4); | |
3439 EXPECT_NE(views.end(), i); | |
3440 } | 3436 } |
3441 | 3437 |
3442 TEST_F(ViewTest, AddExistingChild) { | 3438 TEST_F(ViewTest, AddExistingChild) { |
3443 View v1, v2, v3; | 3439 View v1, v2, v3; |
3444 | 3440 |
3445 v1.AddChildView(&v2); | 3441 v1.AddChildView(&v2); |
3446 v1.AddChildView(&v3); | 3442 v1.AddChildView(&v3); |
3447 EXPECT_EQ(0, v1.GetIndexOf(&v2)); | 3443 EXPECT_EQ(0, v1.GetIndexOf(&v2)); |
3448 EXPECT_EQ(1, v1.GetIndexOf(&v3)); | 3444 EXPECT_EQ(1, v1.GetIndexOf(&v3)); |
3449 | 3445 |
(...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4397 | 4393 |
4398 // The View should continue receiving events after the |handler| is deleted. | 4394 // The View should continue receiving events after the |handler| is deleted. |
4399 v->Reset(); | 4395 v->Reset(); |
4400 ui::MouseEvent released(ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), | 4396 ui::MouseEvent released(ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), |
4401 ui::EventTimeForNow(), 0, 0); | 4397 ui::EventTimeForNow(), 0, 0); |
4402 root->OnMouseReleased(released); | 4398 root->OnMouseReleased(released); |
4403 EXPECT_EQ(ui::ET_MOUSE_RELEASED, v->last_mouse_event_type_); | 4399 EXPECT_EQ(ui::ET_MOUSE_RELEASED, v->last_mouse_event_type_); |
4404 } | 4400 } |
4405 | 4401 |
4406 } // namespace views | 4402 } // namespace views |
OLD | NEW |