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 "chrome/browser/ui/toolbar/toolbar_actions_bar_unittest.h" | 5 #include "chrome/browser/ui/toolbar/toolbar_actions_bar_unittest.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 namespace { | 31 namespace { |
32 | 32 |
33 // Verifies that the toolbar order matches for the given |actions_bar|. If the | 33 // Verifies that the toolbar order matches for the given |actions_bar|. If the |
34 // order matches, the return value is empty; otherwise, it contains the error. | 34 // order matches, the return value is empty; otherwise, it contains the error. |
35 std::string VerifyToolbarOrderForBar( | 35 std::string VerifyToolbarOrderForBar( |
36 const ToolbarActionsBar* actions_bar, | 36 const ToolbarActionsBar* actions_bar, |
37 BrowserActionTestUtil* browser_action_test_util, | 37 BrowserActionTestUtil* browser_action_test_util, |
38 const char* expected_names[], | 38 const char* expected_names[], |
39 size_t total_size, | 39 size_t total_size, |
40 size_t visible_count) { | 40 size_t visible_count) { |
41 const std::vector<ToolbarActionViewController*>& toolbar_actions = | 41 const ToolbarActionsBar::ToolbarActions& toolbar_actions = |
42 actions_bar->toolbar_actions_unordered(); | 42 actions_bar->toolbar_actions_unordered(); |
43 // If the total size is wrong, we risk segfaulting by continuing. Abort now. | 43 // If the total size is wrong, we risk segfaulting by continuing. Abort now. |
44 if (total_size != toolbar_actions.size()) { | 44 if (total_size != toolbar_actions.size()) { |
45 return base::StringPrintf("Incorrect action count: expected %d, found %d", | 45 return base::StringPrintf("Incorrect action count: expected %d, found %d", |
46 static_cast<int>(total_size), | 46 static_cast<int>(total_size), |
47 static_cast<int>(toolbar_actions.size())); | 47 static_cast<int>(toolbar_actions.size())); |
48 } | 48 } |
49 | 49 |
50 // Check that the ToolbarActionsBar matches the expected state. | 50 // Check that the ToolbarActionsBar matches the expected state. |
51 std::string error; | 51 std::string error; |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 extensions::extension_action_test_util::BROWSER_ACTION); | 574 extensions::extension_action_test_util::BROWSER_ACTION); |
575 toolbar_model()->SetVisibleIconCount(0u); | 575 toolbar_model()->SetVisibleIconCount(0u); |
576 { | 576 { |
577 base::RunLoop run_loop; | 577 base::RunLoop run_loop; |
578 toolbar_actions_bar()->PopOutAction(action, true, run_loop.QuitClosure()); | 578 toolbar_actions_bar()->PopOutAction(action, true, run_loop.QuitClosure()); |
579 run_loop.Run(); | 579 run_loop.Run(); |
580 } | 580 } |
581 EXPECT_EQ(1u, toolbar_actions_bar()->GetIconCount()); | 581 EXPECT_EQ(1u, toolbar_actions_bar()->GetIconCount()); |
582 EXPECT_TRUE(toolbar_actions_bar()->NeedsOverflow()); | 582 EXPECT_TRUE(toolbar_actions_bar()->NeedsOverflow()); |
583 } | 583 } |
OLD | NEW |