OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/test/base/web_ui_browser_test.h" | 5 #include "chrome/test/base/web_ui_browser_test.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
11 #include "base/memory/ref_counted_memory.h" | 11 #include "base/memory/ref_counted_memory.h" |
12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 14 #include "base/strings/utf_string_conversions.h" |
14 #include "base/values.h" | 15 #include "base/values.h" |
15 #include "chrome/browser/chrome_content_browser_client.h" | 16 #include "chrome/browser/chrome_content_browser_client.h" |
16 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
18 #include "chrome/browser/ui/browser_commands.h" | 19 #include "chrome/browser/ui/browser_commands.h" |
19 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 20 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
20 #include "chrome/browser/ui/webui/web_ui_test_handler.h" | 21 #include "chrome/browser/ui/webui/web_ui_test_handler.h" |
21 #include "chrome/common/chrome_paths.h" | 22 #include "chrome/common/chrome_paths.h" |
22 #include "chrome/common/url_constants.h" | 23 #include "chrome/common/url_constants.h" |
23 #include "chrome/test/base/test_chrome_web_ui_controller_factory.h" | 24 #include "chrome/test/base/test_chrome_web_ui_controller_factory.h" |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 bool is_async, | 412 bool is_async, |
412 RenderViewHost* preload_host) { | 413 RenderViewHost* preload_host) { |
413 // Get the user libraries. Preloading them individually is best, then | 414 // Get the user libraries. Preloading them individually is best, then |
414 // we can assign each one a filename for better stack traces. Otherwise | 415 // we can assign each one a filename for better stack traces. Otherwise |
415 // append them all to |content|. | 416 // append them all to |content|. |
416 base::string16 content; | 417 base::string16 content; |
417 std::vector<base::string16> libraries; | 418 std::vector<base::string16> libraries; |
418 if (!libraries_preloaded_) { | 419 if (!libraries_preloaded_) { |
419 BuildJavascriptLibraries(&libraries); | 420 BuildJavascriptLibraries(&libraries); |
420 if (!preload_host) { | 421 if (!preload_host) { |
421 content = JoinString(libraries, '\n'); | 422 content = base::JoinString(libraries, base::ASCIIToUTF16("\n")); |
422 libraries.clear(); | 423 libraries.clear(); |
423 } | 424 } |
424 } | 425 } |
425 | 426 |
426 if (!function_name.empty()) { | 427 if (!function_name.empty()) { |
427 base::string16 called_function; | 428 base::string16 called_function; |
428 if (is_test) { | 429 if (is_test) { |
429 called_function = | 430 called_function = |
430 BuildRunTestJSCall(is_async, function_name, function_arguments); | 431 BuildRunTestJSCall(is_async, function_name, function_arguments); |
431 } else { | 432 } else { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 } | 476 } |
476 | 477 |
477 GURL WebUIBrowserTest::WebUITestDataPathToURL( | 478 GURL WebUIBrowserTest::WebUITestDataPathToURL( |
478 const base::FilePath::StringType& path) { | 479 const base::FilePath::StringType& path) { |
479 base::FilePath dir_test_data; | 480 base::FilePath dir_test_data; |
480 EXPECT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &dir_test_data)); | 481 EXPECT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &dir_test_data)); |
481 base::FilePath test_path(dir_test_data.Append(kWebUITestFolder).Append(path)); | 482 base::FilePath test_path(dir_test_data.Append(kWebUITestFolder).Append(path)); |
482 EXPECT_TRUE(base::PathExists(test_path)); | 483 EXPECT_TRUE(base::PathExists(test_path)); |
483 return net::FilePathToFileURL(test_path); | 484 return net::FilePathToFileURL(test_path); |
484 } | 485 } |
OLD | NEW |