| 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <set> | 6 #include <set> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 1430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1441 translate_prefs->ResetTranslationAcceptedCount("fr"); | 1441 translate_prefs->ResetTranslationAcceptedCount("fr"); |
| 1442 translate_prefs->ResetTranslationDeniedCount("fr"); | 1442 translate_prefs->ResetTranslationDeniedCount("fr"); |
| 1443 translate_prefs->ResetTranslationAcceptedCount("de"); | 1443 translate_prefs->ResetTranslationAcceptedCount("de"); |
| 1444 translate_prefs->ResetTranslationDeniedCount("de"); | 1444 translate_prefs->ResetTranslationDeniedCount("de"); |
| 1445 | 1445 |
| 1446 // We'll do 4 times in incognito mode first to make sure the button is not | 1446 // We'll do 4 times in incognito mode first to make sure the button is not |
| 1447 // shown in that case, then 4 times in normal mode. | 1447 // shown in that case, then 4 times in normal mode. |
| 1448 translate::TranslateInfoBarDelegate* infobar; | 1448 translate::TranslateInfoBarDelegate* infobar; |
| 1449 TestingProfile* test_profile = | 1449 TestingProfile* test_profile = |
| 1450 static_cast<TestingProfile*>(web_contents()->GetBrowserContext()); | 1450 static_cast<TestingProfile*>(web_contents()->GetBrowserContext()); |
| 1451 static_cast<extensions::TestExtensionSystem*>( | |
| 1452 extensions::ExtensionSystem::Get(test_profile))->CreateProcessManager(); | |
| 1453 test_profile->ForceIncognito(true); | 1451 test_profile->ForceIncognito(true); |
| 1454 for (int i = 0; i < 8; ++i) { | 1452 for (int i = 0; i < 8; ++i) { |
| 1455 SCOPED_TRACE(::testing::Message() << "Iteration " << i << " incognito mode=" | 1453 SCOPED_TRACE(::testing::Message() << "Iteration " << i << " incognito mode=" |
| 1456 << test_profile->IsOffTheRecord()); | 1454 << test_profile->IsOffTheRecord()); |
| 1457 SimulateNavigation(GURL("http://www.google.fr"), "fr", true); | 1455 SimulateNavigation(GURL("http://www.google.fr"), "fr", true); |
| 1458 infobar = GetTranslateInfoBar(); | 1456 infobar = GetTranslateInfoBar(); |
| 1459 ASSERT_TRUE(infobar != NULL); | 1457 ASSERT_TRUE(infobar != NULL); |
| 1460 EXPECT_EQ(translate::TRANSLATE_STEP_BEFORE_TRANSLATE, | 1458 EXPECT_EQ(translate::TRANSLATE_STEP_BEFORE_TRANSLATE, |
| 1461 infobar->translate_step()); | 1459 infobar->translate_step()); |
| 1462 if (i < 7) { | 1460 if (i < 7) { |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1671 menu->ExecuteCommand(IDC_CONTENT_CONTEXT_TRANSLATE, 0); | 1669 menu->ExecuteCommand(IDC_CONTENT_CONTEXT_TRANSLATE, 0); |
| 1672 | 1670 |
| 1673 // Check the bubble exists instead of the infobar. | 1671 // Check the bubble exists instead of the infobar. |
| 1674 translate::TranslateInfoBarDelegate* infobar = GetTranslateInfoBar(); | 1672 translate::TranslateInfoBarDelegate* infobar = GetTranslateInfoBar(); |
| 1675 ASSERT_TRUE(infobar == NULL); | 1673 ASSERT_TRUE(infobar == NULL); |
| 1676 TranslateBubbleModel* bubble = factory->model(); | 1674 TranslateBubbleModel* bubble = factory->model(); |
| 1677 ASSERT_TRUE(bubble != NULL); | 1675 ASSERT_TRUE(bubble != NULL); |
| 1678 EXPECT_EQ(TranslateBubbleModel::VIEW_STATE_TRANSLATING, | 1676 EXPECT_EQ(TranslateBubbleModel::VIEW_STATE_TRANSLATING, |
| 1679 bubble->GetViewState()); | 1677 bubble->GetViewState()); |
| 1680 } | 1678 } |
| OLD | NEW |