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.
5 #include "chrome/browser/extensions/extension_system.h"
6 #include "chrome/browser/ui/browser.h"
7 #include "chrome/browser/ui/tabs/tab_strip_model.h"
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 ExtensionService
* service
= extensions::ExtensionSystem::Get(
13 browser()->profile())->extension_service();
14 const size_t size_before
= service
->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
);
20 ASSERT_EQ(size_before
+ 1, service
->extensions()->size());
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());