browser_action_apitest.cc revision 5821806d5e7f356e8fa4b058a389a808ea183019
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_tabstrip.h"
6
7// Tests that tooltips of a browser action icon can be specified using UTF8.
8// See http://crbug.com/25349.
9IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, TitleLocalizationBrowserAction) {
10  ExtensionService* service = browser()->profile()->GetExtensionService();
11  const size_t size_before = service->extensions()->size();
12  FilePath extension_path(test_data_dir_.AppendASCII("browsertest")
13                                        .AppendASCII("title_localized"));
14  const Extension* extension = LoadExtension(extension_path);
15  ASSERT_TRUE(extension);
16
17  ASSERT_EQ(size_before + 1, service->extensions()->size());
18
19  EXPECT_STREQ(WideToUTF8(L"Hreggvi\u00F0ur: l10n browser action").c_str(),
20               extension->description().c_str());
21  EXPECT_STREQ(WideToUTF8(L"Hreggvi\u00F0ur is my name").c_str(),
22               extension->name().c_str());
23  int tab_id = ExtensionTabUtil::GetTabId(
24      chrome::GetActiveWebContents(browser()));
25  EXPECT_STREQ(WideToUTF8(L"Hreggvi\u00F0ur").c_str(),
26               extension->browser_action()->GetTitle(tab_id).c_str());
27}
28