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