OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/encoding_menu_controller.h" | 5 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 TEST_F(EncodingMenuControllerTest, ListEncodingMenuItems) { | 45 TEST_F(EncodingMenuControllerTest, ListEncodingMenuItems) { |
46 typedef EncodingMenuController::EncodingMenuItemList EncodingMenuItemList; | 46 typedef EncodingMenuController::EncodingMenuItemList EncodingMenuItemList; |
47 EncodingMenuController controller; | 47 EncodingMenuController controller; |
48 | 48 |
49 EncodingMenuItemList english_items; | 49 EncodingMenuItemList english_items; |
50 TestingProfile profile_en; | 50 TestingProfile profile_en; |
51 | 51 |
52 controller.GetEncodingMenuItems(&profile_en, &english_items); | 52 controller.GetEncodingMenuItems(&profile_en, &english_items); |
53 | 53 |
54 // Make sure there are items in the lists. | 54 // Make sure there are items in the lists. |
55 ASSERT_TRUE(english_items.size() > 0); | 55 ASSERT_FALSE(english_items.empty()); |
56 // Make sure that autodetect is the first item on both menus | 56 // Make sure that autodetect is the first item on both menus |
57 ASSERT_EQ(english_items[0].first, IDC_ENCODING_AUTO_DETECT); | 57 ASSERT_EQ(english_items[0].first, IDC_ENCODING_AUTO_DETECT); |
58 } | 58 } |
59 | 59 |
60 TEST_F(EncodingMenuControllerTest, IsItemChecked) { | 60 TEST_F(EncodingMenuControllerTest, IsItemChecked) { |
61 TestingProfile profile_en; | 61 TestingProfile profile_en; |
62 std::string encoding("UTF-8"); | 62 std::string encoding("UTF-8"); |
63 | 63 |
64 // Check that enabling and disabling autodetect works. | 64 // Check that enabling and disabling autodetect works. |
65 bool autodetect_enabed[] = {true, false}; | 65 bool autodetect_enabed[] = {true, false}; |
(...skipping 18 matching lines...) Expand all Loading... |
84 encoding, | 84 encoding, |
85 valid_encodings[i]); | 85 valid_encodings[i]); |
86 // Only one item in the encoding menu can be selected at a time. | 86 // Only one item in the encoding menu can be selected at a time. |
87 ASSERT_FALSE(on && encoding_is_enabled); | 87 ASSERT_FALSE(on && encoding_is_enabled); |
88 encoding_is_enabled |= on; | 88 encoding_is_enabled |= on; |
89 } | 89 } |
90 | 90 |
91 // Make sure at least one encoding is enabled. | 91 // Make sure at least one encoding is enabled. |
92 ASSERT_TRUE(encoding_is_enabled); | 92 ASSERT_TRUE(encoding_is_enabled); |
93 } | 93 } |
OLD | NEW |