OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 | 5 |
6 #include <algorithm> | 6 #include <algorithm> |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
11 #include "base/stringprintf.h" | 11 #include "base/stringprintf.h" |
12 #include "chrome/app/chrome_command_ids.h" | 12 #include "chrome/app/chrome_command_ids.h" |
13 #include "chrome/browser/prefs/pref_change_registrar.h" | 13 #include "chrome/browser/prefs/pref_change_registrar.h" |
14 #include "chrome/browser/prefs/pref_service.h" | 14 #include "chrome/browser/prefs/pref_service.h" |
15 #include "chrome/browser/tab_contents/infobar.h" | 15 #include "chrome/browser/tab_contents/infobar.h" |
16 #include "chrome/browser/tab_contents/render_view_context_menu.h" | 16 #include "chrome/browser/tab_contents/render_view_context_menu.h" |
17 #include "chrome/browser/translate/translate_infobar_delegate.h" | 17 #include "chrome/browser/translate/translate_infobar_delegate.h" |
18 #include "chrome/browser/translate/translate_manager.h" | 18 #include "chrome/browser/translate/translate_manager.h" |
19 #include "chrome/browser/translate/translate_prefs.h" | 19 #include "chrome/browser/translate/translate_prefs.h" |
20 #include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" | 20 #include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" |
21 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 21 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
22 #include "chrome/common/chrome_notification_types.h" | 22 #include "chrome/common/chrome_notification_types.h" |
23 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
24 #include "chrome/common/render_messages.h" | 24 #include "chrome/common/render_messages.h" |
| 25 #include "chrome/test/base/testing_browser_process.h" |
25 #include "chrome/test/base/testing_profile.h" | 26 #include "chrome/test/base/testing_profile.h" |
26 #include "chrome/test/testing_browser_process.h" | |
27 #include "content/browser/browser_thread.h" | 27 #include "content/browser/browser_thread.h" |
28 #include "content/browser/renderer_host/mock_render_process_host.h" | 28 #include "content/browser/renderer_host/mock_render_process_host.h" |
29 #include "content/browser/renderer_host/test_render_view_host.h" | 29 #include "content/browser/renderer_host/test_render_view_host.h" |
30 #include "content/browser/tab_contents/navigation_details.h" | 30 #include "content/browser/tab_contents/navigation_details.h" |
31 #include "content/browser/tab_contents/test_tab_contents.h" | 31 #include "content/browser/tab_contents/test_tab_contents.h" |
32 #include "content/common/notification_details.h" | 32 #include "content/common/notification_details.h" |
33 #include "content/common/notification_observer_mock.h" | 33 #include "content/common/notification_observer_mock.h" |
34 #include "content/common/notification_registrar.h" | 34 #include "content/common/notification_registrar.h" |
35 #include "content/common/view_messages.h" | 35 #include "content/common/view_messages.h" |
36 #include "content/test/test_url_fetcher_factory.h" | 36 #include "content/test/test_url_fetcher_factory.h" |
(...skipping 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1327 NULL); | 1327 NULL); |
1328 // Now simulate the URL fetch. | 1328 // Now simulate the URL fetch. |
1329 SimulateTranslateScriptURLFetch(true); | 1329 SimulateTranslateScriptURLFetch(true); |
1330 // Now the message should have been sent. | 1330 // Now the message should have been sent. |
1331 int page_id = 0; | 1331 int page_id = 0; |
1332 std::string original_lang, target_lang; | 1332 std::string original_lang, target_lang; |
1333 EXPECT_TRUE(GetTranslateMessage(&page_id, &original_lang, &target_lang)); | 1333 EXPECT_TRUE(GetTranslateMessage(&page_id, &original_lang, &target_lang)); |
1334 EXPECT_EQ("es", original_lang); | 1334 EXPECT_EQ("es", original_lang); |
1335 EXPECT_EQ("en", target_lang); | 1335 EXPECT_EQ("en", target_lang); |
1336 } | 1336 } |
OLD | NEW |