| 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/stringprintf.h" | 10 #include "base/stringprintf.h" |
| (...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 | 687 |
| 688 // Simulate navigating to a page and getting its language. | 688 // Simulate navigating to a page and getting its language. |
| 689 SimulateNavigation(url, "fr", true); | 689 SimulateNavigation(url, "fr", true); |
| 690 | 690 |
| 691 // Close the infobar. | 691 // Close the infobar. |
| 692 EXPECT_TRUE(CloseTranslateInfoBar()); | 692 EXPECT_TRUE(CloseTranslateInfoBar()); |
| 693 | 693 |
| 694 // Create a pending navigation and simulate a page load. That should be the | 694 // Create a pending navigation and simulate a page load. That should be the |
| 695 // equivalent of typing the URL again in the location bar. | 695 // equivalent of typing the URL again in the location bar. |
| 696 NavEntryCommittedObserver nav_observer(contents()); | 696 NavEntryCommittedObserver nav_observer(contents()); |
| 697 contents()->controller().LoadURL(url, GURL(), content::PAGE_TRANSITION_TYPED, | 697 contents()->controller().LoadURL(url, content::Referrer(), |
| 698 content::PAGE_TRANSITION_TYPED, |
| 698 std::string()); | 699 std::string()); |
| 699 rvh()->SendNavigate(0, url); | 700 rvh()->SendNavigate(0, url); |
| 700 | 701 |
| 701 // Test that we are really getting a same page navigation, the test would be | 702 // Test that we are really getting a same page navigation, the test would be |
| 702 // useless if it was not the case. | 703 // useless if it was not the case. |
| 703 const content::LoadCommittedDetails& nav_details = | 704 const content::LoadCommittedDetails& nav_details = |
| 704 nav_observer.get_load_commited_details(); | 705 nav_observer.get_load_commited_details(); |
| 705 EXPECT_TRUE(nav_details.entry != NULL); // There was a navigation. | 706 EXPECT_TRUE(nav_details.entry != NULL); // There was a navigation. |
| 706 EXPECT_EQ(content::NAVIGATION_TYPE_SAME_PAGE, nav_details.type); | 707 EXPECT_EQ(content::NAVIGATION_TYPE_SAME_PAGE, nav_details.type); |
| 707 | 708 |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1340 NULL); | 1341 NULL); |
| 1341 // Now simulate the URL fetch. | 1342 // Now simulate the URL fetch. |
| 1342 SimulateTranslateScriptURLFetch(true); | 1343 SimulateTranslateScriptURLFetch(true); |
| 1343 // Now the message should have been sent. | 1344 // Now the message should have been sent. |
| 1344 int page_id = 0; | 1345 int page_id = 0; |
| 1345 std::string original_lang, target_lang; | 1346 std::string original_lang, target_lang; |
| 1346 EXPECT_TRUE(GetTranslateMessage(&page_id, &original_lang, &target_lang)); | 1347 EXPECT_TRUE(GetTranslateMessage(&page_id, &original_lang, &target_lang)); |
| 1347 EXPECT_EQ("es", original_lang); | 1348 EXPECT_EQ("es", original_lang); |
| 1348 EXPECT_EQ("en", target_lang); | 1349 EXPECT_EQ("en", target_lang); |
| 1349 } | 1350 } |
| OLD | NEW |