OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1341 translate_prefs.ResetTranslationAcceptedCount("fr"); | 1341 translate_prefs.ResetTranslationAcceptedCount("fr"); |
1342 translate_prefs.ResetTranslationDeniedCount("fr"); | 1342 translate_prefs.ResetTranslationDeniedCount("fr"); |
1343 translate_prefs.ResetTranslationAcceptedCount("de"); | 1343 translate_prefs.ResetTranslationAcceptedCount("de"); |
1344 translate_prefs.ResetTranslationDeniedCount("de"); | 1344 translate_prefs.ResetTranslationDeniedCount("de"); |
1345 | 1345 |
1346 // We'll do 4 times in incognito mode first to make sure the button is not | 1346 // We'll do 4 times in incognito mode first to make sure the button is not |
1347 // shown in that case, then 4 times in normal mode. | 1347 // shown in that case, then 4 times in normal mode. |
1348 TranslateInfoBarDelegate* infobar; | 1348 TranslateInfoBarDelegate* infobar; |
1349 TestingProfile* test_profile = | 1349 TestingProfile* test_profile = |
1350 static_cast<TestingProfile*>(contents()->GetBrowserContext()); | 1350 static_cast<TestingProfile*>(contents()->GetBrowserContext()); |
1351 static_cast<TestExtensionSystem*>( | 1351 static_cast<extensions::TestExtensionSystem*>( |
1352 ExtensionSystem::Get(test_profile))-> | 1352 extensions::ExtensionSystem::Get(test_profile))-> |
1353 CreateExtensionProcessManager(); | 1353 CreateExtensionProcessManager(); |
1354 test_profile->set_incognito(true); | 1354 test_profile->set_incognito(true); |
1355 for (int i = 0; i < 8; ++i) { | 1355 for (int i = 0; i < 8; ++i) { |
1356 SCOPED_TRACE(::testing::Message() << "Iteration " << i << | 1356 SCOPED_TRACE(::testing::Message() << "Iteration " << i << |
1357 " incognito mode=" << test_profile->IsOffTheRecord()); | 1357 " incognito mode=" << test_profile->IsOffTheRecord()); |
1358 SimulateNavigation(GURL("http://www.google.fr"), "fr", true); | 1358 SimulateNavigation(GURL("http://www.google.fr"), "fr", true); |
1359 infobar = GetTranslateInfoBar(); | 1359 infobar = GetTranslateInfoBar(); |
1360 ASSERT_TRUE(infobar != NULL); | 1360 ASSERT_TRUE(infobar != NULL); |
1361 EXPECT_EQ(TranslateInfoBarDelegate::BEFORE_TRANSLATE, infobar->type()); | 1361 EXPECT_EQ(TranslateInfoBarDelegate::BEFORE_TRANSLATE, infobar->type()); |
1362 if (i < 7) { | 1362 if (i < 7) { |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1459 NULL); | 1459 NULL); |
1460 // Now simulate the URL fetch. | 1460 // Now simulate the URL fetch. |
1461 SimulateTranslateScriptURLFetch(true); | 1461 SimulateTranslateScriptURLFetch(true); |
1462 // Now the message should have been sent. | 1462 // Now the message should have been sent. |
1463 int page_id = 0; | 1463 int page_id = 0; |
1464 std::string original_lang, target_lang; | 1464 std::string original_lang, target_lang; |
1465 EXPECT_TRUE(GetTranslateMessage(&page_id, &original_lang, &target_lang)); | 1465 EXPECT_TRUE(GetTranslateMessage(&page_id, &original_lang, &target_lang)); |
1466 EXPECT_EQ("es", original_lang); | 1466 EXPECT_EQ("es", original_lang); |
1467 EXPECT_EQ("en", target_lang); | 1467 EXPECT_EQ("en", target_lang); |
1468 } | 1468 } |
OLD | NEW |