| 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 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1226 translate_prefs.ResetTranslationAcceptedCount("fr"); | 1226 translate_prefs.ResetTranslationAcceptedCount("fr"); |
| 1227 translate_prefs.ResetTranslationDeniedCount("fr"); | 1227 translate_prefs.ResetTranslationDeniedCount("fr"); |
| 1228 translate_prefs.ResetTranslationAcceptedCount("de"); | 1228 translate_prefs.ResetTranslationAcceptedCount("de"); |
| 1229 translate_prefs.ResetTranslationDeniedCount("de"); | 1229 translate_prefs.ResetTranslationDeniedCount("de"); |
| 1230 | 1230 |
| 1231 // We'll do 4 times in incognito mode first to make sure the button is not | 1231 // We'll do 4 times in incognito mode first to make sure the button is not |
| 1232 // shown in that case, then 4 times in normal mode. | 1232 // shown in that case, then 4 times in normal mode. |
| 1233 TranslateInfoBarDelegate* infobar; | 1233 TranslateInfoBarDelegate* infobar; |
| 1234 TestingProfile* test_profile = | 1234 TestingProfile* test_profile = |
| 1235 static_cast<TestingProfile*>(contents()->browser_context()); | 1235 static_cast<TestingProfile*>(contents()->browser_context()); |
| 1236 test_profile->CreateExtensionProcessManager(); |
| 1236 test_profile->set_incognito(true); | 1237 test_profile->set_incognito(true); |
| 1237 for (int i = 0; i < 8; ++i) { | 1238 for (int i = 0; i < 8; ++i) { |
| 1238 SCOPED_TRACE(::testing::Message() << "Iteration " << i << | 1239 SCOPED_TRACE(::testing::Message() << "Iteration " << i << |
| 1239 " incognito mode=" << test_profile->IsOffTheRecord()); | 1240 " incognito mode=" << test_profile->IsOffTheRecord()); |
| 1240 SimulateNavigation(GURL("http://www.google.fr"), "fr", true); | 1241 SimulateNavigation(GURL("http://www.google.fr"), "fr", true); |
| 1241 infobar = GetTranslateInfoBar(); | 1242 infobar = GetTranslateInfoBar(); |
| 1242 ASSERT_TRUE(infobar != NULL); | 1243 ASSERT_TRUE(infobar != NULL); |
| 1243 EXPECT_EQ(TranslateInfoBarDelegate::BEFORE_TRANSLATE, infobar->type()); | 1244 EXPECT_EQ(TranslateInfoBarDelegate::BEFORE_TRANSLATE, infobar->type()); |
| 1244 if (i < 7) { | 1245 if (i < 7) { |
| 1245 EXPECT_FALSE(infobar->ShouldShowAlwaysTranslateButton()); | 1246 EXPECT_FALSE(infobar->ShouldShowAlwaysTranslateButton()); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1339 NULL); | 1340 NULL); |
| 1340 // Now simulate the URL fetch. | 1341 // Now simulate the URL fetch. |
| 1341 SimulateTranslateScriptURLFetch(true); | 1342 SimulateTranslateScriptURLFetch(true); |
| 1342 // Now the message should have been sent. | 1343 // Now the message should have been sent. |
| 1343 int page_id = 0; | 1344 int page_id = 0; |
| 1344 std::string original_lang, target_lang; | 1345 std::string original_lang, target_lang; |
| 1345 EXPECT_TRUE(GetTranslateMessage(&page_id, &original_lang, &target_lang)); | 1346 EXPECT_TRUE(GetTranslateMessage(&page_id, &original_lang, &target_lang)); |
| 1346 EXPECT_EQ("es", original_lang); | 1347 EXPECT_EQ("es", original_lang); |
| 1347 EXPECT_EQ("en", target_lang); | 1348 EXPECT_EQ("en", target_lang); |
| 1348 } | 1349 } |
| OLD | NEW |