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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include <algorithm> | |
8 #include <memory> | 7 #include <memory> |
9 #include <set> | 8 #include <set> |
10 #include <tuple> | 9 #include <tuple> |
11 #include <utility> | 10 #include <utility> |
12 #include <vector> | 11 #include <vector> |
13 | 12 |
14 #include "base/command_line.h" | 13 #include "base/command_line.h" |
15 #include "base/macros.h" | 14 #include "base/macros.h" |
16 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
| 16 #include "base/stl_util.h" |
17 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
18 #include "build/build_config.h" | 18 #include "build/build_config.h" |
19 #include "chrome/app/chrome_command_ids.h" | 19 #include "chrome/app/chrome_command_ids.h" |
20 #include "chrome/browser/chrome_notification_types.h" | 20 #include "chrome/browser/chrome_notification_types.h" |
21 #include "chrome/browser/extensions/test_extension_system.h" | 21 #include "chrome/browser/extensions/test_extension_system.h" |
22 #include "chrome/browser/infobars/infobar_service.h" | 22 #include "chrome/browser/infobars/infobar_service.h" |
23 #include "chrome/browser/renderer_context_menu/render_view_context_menu_test_uti
l.h" | 23 #include "chrome/browser/renderer_context_menu/render_view_context_menu_test_uti
l.h" |
24 #include "chrome/browser/translate/chrome_translate_client.h" | 24 #include "chrome/browser/translate/chrome_translate_client.h" |
25 #include "chrome/browser/translate/translate_service.h" | 25 #include "chrome/browser/translate/translate_service.h" |
26 #include "chrome/browser/ui/browser_window.h" | 26 #include "chrome/browser/ui/browser_window.h" |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 current_supported_languages.clear(); | 601 current_supported_languages.clear(); |
602 translate::TranslateDownloadManager::GetSupportedLanguages( | 602 translate::TranslateDownloadManager::GetSupportedLanguages( |
603 ¤t_supported_languages); | 603 ¤t_supported_languages); |
604 // "xx" can't be displayed in the Translate infobar, so this is eliminated. | 604 // "xx" can't be displayed in the Translate infobar, so this is eliminated. |
605 EXPECT_EQ(server_languages.size() - 1, current_supported_languages.size()); | 605 EXPECT_EQ(server_languages.size() - 1, current_supported_languages.size()); |
606 // Not sure we need to guarantee the order of languages, so we find them. | 606 // Not sure we need to guarantee the order of languages, so we find them. |
607 for (size_t i = 0; i < server_languages.size(); ++i) { | 607 for (size_t i = 0; i < server_languages.size(); ++i) { |
608 const std::string& lang = server_languages[i]; | 608 const std::string& lang = server_languages[i]; |
609 if (lang == "xx") | 609 if (lang == "xx") |
610 continue; | 610 continue; |
611 EXPECT_NE(current_supported_languages.end(), | 611 EXPECT_TRUE(base::ContainsValue(current_supported_languages, lang)) |
612 std::find(current_supported_languages.begin(), | |
613 current_supported_languages.end(), lang)) | |
614 << "lang=" << lang; | 612 << "lang=" << lang; |
615 } | 613 } |
616 } | 614 } |
617 | 615 |
618 // The rest of the tests in this file depend on the translate infobar. They | 616 // The rest of the tests in this file depend on the translate infobar. They |
619 // should be ported to use the translate bubble. On Aura there is no infobar | 617 // should be ported to use the translate bubble. On Aura there is no infobar |
620 // so the tests are not compiled. | 618 // so the tests are not compiled. |
621 #if !defined(USE_AURA) | 619 #if !defined(USE_AURA) |
622 TEST_F(TranslateManagerRenderViewHostTest, NormalTranslate) { | 620 TEST_F(TranslateManagerRenderViewHostTest, NormalTranslate) { |
623 // See BubbleNormalTranslate for corresponding bubble UX testing. | 621 // See BubbleNormalTranslate for corresponding bubble UX testing. |
(...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1754 | 1752 |
1755 // Check the bubble exists instead of the infobar. | 1753 // Check the bubble exists instead of the infobar. |
1756 translate::TranslateInfoBarDelegate* infobar = GetTranslateInfoBar(); | 1754 translate::TranslateInfoBarDelegate* infobar = GetTranslateInfoBar(); |
1757 ASSERT_TRUE(infobar == NULL); | 1755 ASSERT_TRUE(infobar == NULL); |
1758 TranslateBubbleModel* bubble = factory->model(); | 1756 TranslateBubbleModel* bubble = factory->model(); |
1759 ASSERT_TRUE(bubble != NULL); | 1757 ASSERT_TRUE(bubble != NULL); |
1760 EXPECT_EQ(TranslateBubbleModel::VIEW_STATE_TRANSLATING, | 1758 EXPECT_EQ(TranslateBubbleModel::VIEW_STATE_TRANSLATING, |
1761 bubble->GetViewState()); | 1759 bubble->GetViewState()); |
1762 } | 1760 } |
1763 #endif // defined(USE_AURA) | 1761 #endif // defined(USE_AURA) |
OLD | NEW |