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 3 // found in the LICENSE file. 4 5 #include "chrome/browser/ui/browser.h" 6 #include "chrome/browser/ui/tabs/tab_strip_model.h" 7 #include "extensions/browser/extension_registry.h" 8 9 // Tests that tooltips of a browser action icon can be specified using UTF8. 10 // See http://crbug.com/25349. 11 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, TitleLocalizationBrowserAction) { 12 extension::ExtensionRegistry* registry = 13 extensions::ExtensionRegistry::Get(browser()->profile()); 14 const size_t size_before = registry->enabled_extensions().size(); 15 base::FilePath extension_path(test_data_dir_.AppendASCII("browsertest") 16 .AppendASCII("title_localized")); 17 const Extension* extension = LoadExtension(extension_path); 18 ASSERT_TRUE(extension); 19 20 ASSERT_EQ(size_before + 1, registry->enabled_extensions().size()); 21 22 EXPECT_STREQ(base::WideToUTF8( 23 L"Hreggvi\u00F0ur: l10n browser action").c_str(), 24 extension->description().c_str()); 25 EXPECT_STREQ(base::WideToUTF8(L"Hreggvi\u00F0ur is my name").c_str(), 26 extension->name().c_str()); 27 int tab_id = ExtensionTabUtil::GetTabId( 28 browser()->tab_strip_model()->GetActiveWebContents()); 29 EXPECT_STREQ(base::WideToUTF8(L"Hreggvi\u00F0ur").c_str(), 30 extension->browser_action()->GetTitle(tab_id).c_str()); 31 } 32