blob: fcf84caa45ca2041c6d14a8c3bb7326b8ab2b1fc [file] [log] [blame]
[email protected]fad73672012-06-15 23:26:061// 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
avia2f4804a2015-12-24 23:11:135#include <stddef.h>
6
[email protected]da2bfa42013-01-29 23:47:057#include "chrome/browser/ui/browser.h"
8#include "chrome/browser/ui/tabs/tab_strip_model.h"
[email protected]7c82539c2014-02-19 06:09:179#include "extensions/browser/extension_registry.h"
[email protected]52877dbc62012-06-29 22:22:0310
[email protected]fad73672012-06-15 23:26:0611// Tests that tooltips of a browser action icon can be specified using UTF8.
12// See http://crbug.com/25349.
13IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, TitleLocalizationBrowserAction) {
[email protected]7c82539c2014-02-19 06:09:1714 extension::ExtensionRegistry* registry =
15 extensions::ExtensionRegistry::Get(browser()->profile());
16 const size_t size_before = registry->enabled_extensions().size();
[email protected]650b2d52013-02-10 03:41:4517 base::FilePath extension_path(test_data_dir_.AppendASCII("browsertest")
[email protected]fad73672012-06-15 23:26:0618 .AppendASCII("title_localized"));
19 const Extension* extension = LoadExtension(extension_path);
20 ASSERT_TRUE(extension);
21
[email protected]7c82539c2014-02-19 06:09:1722 ASSERT_EQ(size_before + 1, registry->enabled_extensions().size());
[email protected]fad73672012-06-15 23:26:0623
[email protected]04338722013-12-24 23:18:0524 EXPECT_STREQ(base::WideToUTF8(
25 L"Hreggvi\u00F0ur: l10n browser action").c_str(),
[email protected]47e870b2013-02-24 21:14:5326 extension->description().c_str());
[email protected]04338722013-12-24 23:18:0527 EXPECT_STREQ(base::WideToUTF8(L"Hreggvi\u00F0ur is my name").c_str(),
[email protected]fad73672012-06-15 23:26:0628 extension->name().c_str());
[email protected]52877dbc62012-06-29 22:22:0329 int tab_id = ExtensionTabUtil::GetTabId(
[email protected]da2bfa42013-01-29 23:47:0530 browser()->tab_strip_model()->GetActiveWebContents());
[email protected]04338722013-12-24 23:18:0531 EXPECT_STREQ(base::WideToUTF8(L"Hreggvi\u00F0ur").c_str(),
[email protected]fad73672012-06-15 23:26:0632 extension->browser_action()->GetTitle(tab_id).c_str());
33}