browser_action_apitest.cc revision 5821806d5e7f356e8fa4b058a389a808ea183019
15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/browser/ui/browser_tabstrip.h"
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Tests that tooltips of a browser action icon can be specified using UTF8.
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// See http://crbug.com/25349.
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, TitleLocalizationBrowserAction) {
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  ExtensionService* service = browser()->profile()->GetExtensionService();
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  const size_t size_before = service->extensions()->size();
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  FilePath extension_path(test_data_dir_.AppendASCII("browsertest")
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                        .AppendASCII("title_localized"));
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  const Extension* extension = LoadExtension(extension_path);
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  ASSERT_TRUE(extension);
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  ASSERT_EQ(size_before + 1, service->extensions()->size());
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  EXPECT_STREQ(WideToUTF8(L"Hreggvi\u00F0ur: l10n browser action").c_str(),
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)               extension->description().c_str());
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  EXPECT_STREQ(WideToUTF8(L"Hreggvi\u00F0ur is my name").c_str(),
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)               extension->name().c_str());
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  int tab_id = ExtensionTabUtil::GetTabId(
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      chrome::GetActiveWebContents(browser()));
255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  EXPECT_STREQ(WideToUTF8(L"Hreggvi\u00F0ur").c_str(),
265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)               extension->browser_action()->GetTitle(tab_id).c_str());
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
28