| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "chrome/browser/ui/browser.h" | 7 #include "chrome/browser/ui/browser.h" |
| 8 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 8 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 9 #include "chrome/test/base/in_process_browser_test.h" | 9 #include "chrome/test/base/in_process_browser_test.h" |
| 10 #include "chrome/test/base/ui_test_utils.h" | 10 #include "chrome/test/base/ui_test_utils.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 *include_libraries_iterator); | 37 *include_libraries_iterator); |
| 38 library_content.AppendToString(&script); | 38 library_content.AppendToString(&script); |
| 39 script.append("\n"); | 39 script.append("\n"); |
| 40 } | 40 } |
| 41 ExecuteJavascriptOnCurrentTab(script); | 41 ExecuteJavascriptOnCurrentTab(script); |
| 42 | 42 |
| 43 content::DOMMessageQueue message_queue; | 43 content::DOMMessageQueue message_queue; |
| 44 std::string message; | 44 std::string message; |
| 45 ExecuteJavascriptOnCurrentTab("runTests()"); | 45 ExecuteJavascriptOnCurrentTab("runTests()"); |
| 46 ASSERT_TRUE(message_queue.WaitForMessage(&message)); | 46 ASSERT_TRUE(message_queue.WaitForMessage(&message)); |
| 47 while (message.compare("\"PENDING\"") == 0) { |
| 48 ASSERT_TRUE(message_queue.WaitForMessage(&message)); |
| 49 } |
| 47 EXPECT_STREQ("\"SUCCESS\"", message.c_str()); | 50 EXPECT_STREQ("\"SUCCESS\"", message.c_str()); |
| 48 } | 51 } |
| 49 | 52 |
| 50 // Queues the library corresponding to |resource_id| for injection into the | 53 // Queues the library corresponding to |resource_id| for injection into the |
| 51 // test. The code injection is performed post-load, so any common test | 54 // test. The code injection is performed post-load, so any common test |
| 52 // initialization that depends on the library should be placed in a setUp | 55 // initialization that depends on the library should be placed in a setUp |
| 53 // function. | 56 // function. |
| 54 void AddLibrary(int resource_id) { | 57 void AddLibrary(int resource_id) { |
| 55 include_libraries.push_back(resource_id); | 58 include_libraries.push_back(resource_id); |
| 56 } | 59 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 AddLibrary(IDR_WEBUI_JS_CR_EVENT_TARGET); | 108 AddLibrary(IDR_WEBUI_JS_CR_EVENT_TARGET); |
| 106 AddLibrary(IDR_WEBUI_JS_CR_UI_LIST_SELECTION_MODEL); | 109 AddLibrary(IDR_WEBUI_JS_CR_UI_LIST_SELECTION_MODEL); |
| 107 RunTest(base::FilePath(FILE_PATH_LITERAL("list_selection_model_test.html"))); | 110 RunTest(base::FilePath(FILE_PATH_LITERAL("list_selection_model_test.html"))); |
| 108 } | 111 } |
| 109 | 112 |
| 110 IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, LocalStringsTest) { | 113 IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, LocalStringsTest) { |
| 111 AddLibrary(IDR_WEBUI_JS_LOCAL_STRINGS); | 114 AddLibrary(IDR_WEBUI_JS_LOCAL_STRINGS); |
| 112 RunTest(base::FilePath(FILE_PATH_LITERAL("local_strings_test.html"))); | 115 RunTest(base::FilePath(FILE_PATH_LITERAL("local_strings_test.html"))); |
| 113 } | 116 } |
| 114 | 117 |
| 118 IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, ParseHtmlSubsetTest) { |
| 119 AddLibrary(IDR_WEBUI_JS_PARSE_HTML_SUBSET); |
| 120 RunTest(base::FilePath(FILE_PATH_LITERAL("parse_html_subset_test.html"))); |
| 121 } |
| 122 |
| 115 IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, PositionUtilTest) { | 123 IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, PositionUtilTest) { |
| 116 AddLibrary(IDR_WEBUI_JS_CR); | 124 AddLibrary(IDR_WEBUI_JS_CR); |
| 117 AddLibrary(IDR_WEBUI_JS_CR_UI_POSITION_UTIL); | 125 AddLibrary(IDR_WEBUI_JS_CR_UI_POSITION_UTIL); |
| 118 RunTest(base::FilePath(FILE_PATH_LITERAL("position_util_test.html"))); | 126 RunTest(base::FilePath(FILE_PATH_LITERAL("position_util_test.html"))); |
| 119 } | 127 } |
| OLD | NEW |