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

Side by Side Diff: ui/views/view_unittest.cc

Issue 108063004: Give up focus if the focused view becomes unfocusable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years 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 | Annotate | Revision Log
OLDNEW
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 <map> 5 #include <map>
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/rand_util.h" 8 #include "base/rand_util.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 2752 matching lines...) Expand 10 before | Expand all | Expand 10 after
2763 2763
2764 View* child = new View(); 2764 View* child = new View();
2765 root.AddChildView(child); 2765 root.AddChildView(child);
2766 2766
2767 View* foo1 = new View(); 2767 View* foo1 = new View();
2768 child->AddChildView(foo1); 2768 child->AddChildView(foo1);
2769 View* foo2 = new View(); 2769 View* foo2 = new View();
2770 child->AddChildView(foo2); 2770 child->AddChildView(foo2);
2771 View* foo3 = new View(); 2771 View* foo3 = new View();
2772 child->AddChildView(foo3); 2772 child->AddChildView(foo3);
2773 foo1->set_focusable(true); 2773 foo1->SetFocusable(true);
2774 foo2->set_focusable(true); 2774 foo2->SetFocusable(true);
2775 foo3->set_focusable(true); 2775 foo3->SetFocusable(true);
2776 2776
2777 ASSERT_EQ(0, child->GetIndexOf(foo1)); 2777 ASSERT_EQ(0, child->GetIndexOf(foo1));
2778 ASSERT_EQ(1, child->GetIndexOf(foo2)); 2778 ASSERT_EQ(1, child->GetIndexOf(foo2));
2779 ASSERT_EQ(2, child->GetIndexOf(foo3)); 2779 ASSERT_EQ(2, child->GetIndexOf(foo3));
2780 ASSERT_EQ(foo2, foo1->GetNextFocusableView()); 2780 ASSERT_EQ(foo2, foo1->GetNextFocusableView());
2781 ASSERT_EQ(foo3, foo2->GetNextFocusableView()); 2781 ASSERT_EQ(foo3, foo2->GetNextFocusableView());
2782 ASSERT_EQ(NULL, foo3->GetNextFocusableView()); 2782 ASSERT_EQ(NULL, foo3->GetNextFocusableView());
2783 2783
2784 // Move |foo2| at the end. 2784 // Move |foo2| at the end.
2785 child->ReorderChildView(foo2, -1); 2785 child->ReorderChildView(foo2, -1);
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
3482 const std::vector<ui::Layer*>& child_layers_post = root_layer->children(); 3482 const std::vector<ui::Layer*>& child_layers_post = root_layer->children();
3483 ASSERT_EQ(3u, child_layers_post.size()); 3483 ASSERT_EQ(3u, child_layers_post.size());
3484 EXPECT_EQ(v1->layer(), child_layers_post[0]); 3484 EXPECT_EQ(v1->layer(), child_layers_post[0]);
3485 EXPECT_EQ(v2->layer(), child_layers_post[1]); 3485 EXPECT_EQ(v2->layer(), child_layers_post[1]);
3486 EXPECT_EQ(v1_old_layer, child_layers_post[2]); 3486 EXPECT_EQ(v1_old_layer, child_layers_post[2]);
3487 } 3487 }
3488 3488
3489 #endif // USE_AURA 3489 #endif // USE_AURA
3490 3490
3491 } // namespace views 3491 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698