Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Side by Side Diff: chrome/browser/policy/policy_browsertest.cc

Issue 10952016: Simplify the translate infobar code some. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include <algorithm> 5 #include <algorithm>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after
1101 content::NotificationService::AllSources()); 1101 content::NotificationService::AllSources());
1102 ui_test_utils::NavigateToURL(browser(), url); 1102 ui_test_utils::NavigateToURL(browser(), url);
1103 language_observer1.Wait(); 1103 language_observer1.Wait();
1104 // Verify that the translate infobar showed up. 1104 // Verify that the translate infobar showed up.
1105 ASSERT_EQ(1u, infobar_helper->GetInfoBarCount()); 1105 ASSERT_EQ(1u, infobar_helper->GetInfoBarCount());
1106 InfoBarDelegate* infobar_delegate = infobar_helper->GetInfoBarDelegateAt(0); 1106 InfoBarDelegate* infobar_delegate = infobar_helper->GetInfoBarDelegateAt(0);
1107 TranslateInfoBarDelegate* delegate = 1107 TranslateInfoBarDelegate* delegate =
1108 infobar_delegate->AsTranslateInfoBarDelegate(); 1108 infobar_delegate->AsTranslateInfoBarDelegate();
1109 ASSERT_TRUE(delegate); 1109 ASSERT_TRUE(delegate);
1110 EXPECT_EQ(TranslateInfoBarDelegate::BEFORE_TRANSLATE, delegate->type()); 1110 EXPECT_EQ(TranslateInfoBarDelegate::BEFORE_TRANSLATE, delegate->type());
1111 EXPECT_EQ("fr", delegate->GetOriginalLanguageCode()); 1111 EXPECT_EQ("fr", delegate->original_language_code());
1112 1112
1113 // Now force disable translate. 1113 // Now force disable translate.
1114 ui_test_utils::CloseAllInfoBars(tab_contents); 1114 ui_test_utils::CloseAllInfoBars(tab_contents);
1115 EXPECT_EQ(0u, infobar_helper->GetInfoBarCount()); 1115 EXPECT_EQ(0u, infobar_helper->GetInfoBarCount());
1116 policies.Set(key::kTranslateEnabled, POLICY_LEVEL_MANDATORY, 1116 policies.Set(key::kTranslateEnabled, POLICY_LEVEL_MANDATORY,
1117 POLICY_SCOPE_USER, base::Value::CreateBooleanValue(false)); 1117 POLICY_SCOPE_USER, base::Value::CreateBooleanValue(false));
1118 provider_.UpdateChromePolicy(policies); 1118 provider_.UpdateChromePolicy(policies);
1119 // Navigating to the same URL now doesn't trigger an infobar. 1119 // Navigating to the same URL now doesn't trigger an infobar.
1120 content::WindowedNotificationObserver language_observer2( 1120 content::WindowedNotificationObserver language_observer2(
1121 chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED, 1121 chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED,
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
1348 INSTANTIATE_TEST_CASE_P( 1348 INSTANTIATE_TEST_CASE_P(
1349 RestoreOnStartupPolicyTestInstance, 1349 RestoreOnStartupPolicyTestInstance,
1350 RestoreOnStartupPolicyTest, 1350 RestoreOnStartupPolicyTest,
1351 testing::Values(&RestoreOnStartupPolicyTest::HomepageIsNotNTP, 1351 testing::Values(&RestoreOnStartupPolicyTest::HomepageIsNotNTP,
1352 &RestoreOnStartupPolicyTest::HomepageIsNTP, 1352 &RestoreOnStartupPolicyTest::HomepageIsNTP,
1353 &RestoreOnStartupPolicyTest::ListOfURLs, 1353 &RestoreOnStartupPolicyTest::ListOfURLs,
1354 &RestoreOnStartupPolicyTest::NTP, 1354 &RestoreOnStartupPolicyTest::NTP,
1355 &RestoreOnStartupPolicyTest::Last)); 1355 &RestoreOnStartupPolicyTest::Last));
1356 1356
1357 } // namespace policy 1357 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698