OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/files/file_path.h" | 5 #include "base/files/file_path.h" |
6 #include "base/files/file_util.h" | 6 #include "base/files/file_util.h" |
7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "base/threading/thread_restrictions.h" |
9 #include "chrome/browser/extensions/extension_apitest.h" | 10 #include "chrome/browser/extensions/extension_apitest.h" |
10 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
11 #include "chrome/test/base/ui_test_utils.h" | 12 #include "chrome/test/base/ui_test_utils.h" |
12 #include "extensions/common/extension.h" | 13 #include "extensions/common/extension.h" |
13 #include "extensions/test/result_catcher.h" | 14 #include "extensions/test/result_catcher.h" |
14 #include "net/test/embedded_test_server/embedded_test_server.h" | 15 #include "net/test/embedded_test_server/embedded_test_server.h" |
15 | 16 |
16 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, I18N) { | 17 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, I18N) { |
17 ASSERT_TRUE(StartEmbeddedTestServer()); | 18 ASSERT_TRUE(StartEmbeddedTestServer()); |
18 ASSERT_TRUE(RunExtensionTest("i18n")) << message_; | 19 ASSERT_TRUE(RunExtensionTest("i18n")) << message_; |
19 } | 20 } |
20 | 21 |
21 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, I18NUpdate) { | 22 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, I18NUpdate) { |
22 ASSERT_TRUE(embedded_test_server()->Start()); | 23 ASSERT_TRUE(embedded_test_server()->Start()); |
23 // Create an Extension whose messages.json file will be updated. | 24 // Create an Extension whose messages.json file will be updated. |
| 25 base::ThreadRestrictions::ScopedAllowIO allow_io; |
24 base::ScopedTempDir extension_dir; | 26 base::ScopedTempDir extension_dir; |
25 ASSERT_TRUE(extension_dir.CreateUniqueTempDir()); | 27 ASSERT_TRUE(extension_dir.CreateUniqueTempDir()); |
26 base::CopyFile( | 28 base::CopyFile( |
27 test_data_dir_.AppendASCII("i18nUpdate").AppendASCII("manifest.json"), | 29 test_data_dir_.AppendASCII("i18nUpdate").AppendASCII("manifest.json"), |
28 extension_dir.GetPath().AppendASCII("manifest.json")); | 30 extension_dir.GetPath().AppendASCII("manifest.json")); |
29 base::CopyFile( | 31 base::CopyFile( |
30 test_data_dir_.AppendASCII("i18nUpdate").AppendASCII("contentscript.js"), | 32 test_data_dir_.AppendASCII("i18nUpdate").AppendASCII("contentscript.js"), |
31 extension_dir.GetPath().AppendASCII("contentscript.js")); | 33 extension_dir.GetPath().AppendASCII("contentscript.js")); |
32 base::CopyDirectory( | 34 base::CopyDirectory( |
33 test_data_dir_.AppendASCII("i18nUpdate").AppendASCII("_locales"), | 35 test_data_dir_.AppendASCII("i18nUpdate").AppendASCII("_locales"), |
(...skipping 22 matching lines...) Expand all Loading... |
56 | 58 |
57 // Check that the i18n message is also changed. | 59 // Check that the i18n message is also changed. |
58 ui_test_utils::NavigateToURL( | 60 ui_test_utils::NavigateToURL( |
59 browser(), | 61 browser(), |
60 embedded_test_server()->GetURL("/extensions/test_file.html")); | 62 embedded_test_server()->GetURL("/extensions/test_file.html")); |
61 EXPECT_TRUE(catcher.GetNextResult()); | 63 EXPECT_TRUE(catcher.GetNextResult()); |
62 | 64 |
63 ui_test_utils::GetCurrentTabTitle(browser(), &title); | 65 ui_test_utils::GetCurrentTabTitle(browser(), &title); |
64 EXPECT_EQ(std::string("SECONDMESSAGE"), base::UTF16ToUTF8(title)); | 66 EXPECT_EQ(std::string("SECONDMESSAGE"), base::UTF16ToUTF8(title)); |
65 } | 67 } |
OLD | NEW |