[email protected] | fad7367 | 2012-06-15 23:26:06 | [diff] [blame] | 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 | |||||
avi | a2f4804a | 2015-12-24 23:11:13 | [diff] [blame] | 5 | #include <stddef.h> |
6 | |||||
[email protected] | da2bfa4 | 2013-01-29 23:47:05 | [diff] [blame] | 7 | #include "chrome/browser/ui/browser.h" |
8 | #include "chrome/browser/ui/tabs/tab_strip_model.h" | ||||
[email protected] | 7c82539c | 2014-02-19 06:09:17 | [diff] [blame] | 9 | #include "extensions/browser/extension_registry.h" |
[email protected] | 52877dbc6 | 2012-06-29 22:22:03 | [diff] [blame] | 10 | |
[email protected] | fad7367 | 2012-06-15 23:26:06 | [diff] [blame] | 11 | // Tests that tooltips of a browser action icon can be specified using UTF8. |
12 | // See http://crbug.com/25349. | ||||
13 | IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, TitleLocalizationBrowserAction) { | ||||
[email protected] | 7c82539c | 2014-02-19 06:09:17 | [diff] [blame] | 14 | extension::ExtensionRegistry* registry = |
15 | extensions::ExtensionRegistry::Get(browser()->profile()); | ||||
16 | const size_t size_before = registry->enabled_extensions().size(); | ||||
[email protected] | 650b2d5 | 2013-02-10 03:41:45 | [diff] [blame] | 17 | base::FilePath extension_path(test_data_dir_.AppendASCII("browsertest") |
[email protected] | fad7367 | 2012-06-15 23:26:06 | [diff] [blame] | 18 | .AppendASCII("title_localized")); |
19 | const Extension* extension = LoadExtension(extension_path); | ||||
20 | ASSERT_TRUE(extension); | ||||
21 | |||||
[email protected] | 7c82539c | 2014-02-19 06:09:17 | [diff] [blame] | 22 | ASSERT_EQ(size_before + 1, registry->enabled_extensions().size()); |
[email protected] | fad7367 | 2012-06-15 23:26:06 | [diff] [blame] | 23 | |
[email protected] | 0433872 | 2013-12-24 23:18:05 | [diff] [blame] | 24 | EXPECT_STREQ(base::WideToUTF8( |
25 | L"Hreggvi\u00F0ur: l10n browser action").c_str(), | ||||
[email protected] | 47e870b | 2013-02-24 21:14:53 | [diff] [blame] | 26 | extension->description().c_str()); |
[email protected] | 0433872 | 2013-12-24 23:18:05 | [diff] [blame] | 27 | EXPECT_STREQ(base::WideToUTF8(L"Hreggvi\u00F0ur is my name").c_str(), |
[email protected] | fad7367 | 2012-06-15 23:26:06 | [diff] [blame] | 28 | extension->name().c_str()); |
[email protected] | 52877dbc6 | 2012-06-29 22:22:03 | [diff] [blame] | 29 | int tab_id = ExtensionTabUtil::GetTabId( |
[email protected] | da2bfa4 | 2013-01-29 23:47:05 | [diff] [blame] | 30 | browser()->tab_strip_model()->GetActiveWebContents()); |
[email protected] | 0433872 | 2013-12-24 23:18:05 | [diff] [blame] | 31 | EXPECT_STREQ(base::WideToUTF8(L"Hreggvi\u00F0ur").c_str(), |
[email protected] | fad7367 | 2012-06-15 23:26:06 | [diff] [blame] | 32 | extension->browser_action()->GetTitle(tab_id).c_str()); |
33 | } |