| 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 base::Unretained(this))); | 123 base::Unretained(this))); |
| 124 web_ui()->RegisterMessageCallback("testPasses", | 124 web_ui()->RegisterMessageCallback("testPasses", |
| 125 base::Bind(&AsyncWebUIMessageHandler::HandleTestPasses, | 125 base::Bind(&AsyncWebUIMessageHandler::HandleTestPasses, |
| 126 base::Unretained(this))); | 126 base::Unretained(this))); |
| 127 } | 127 } |
| 128 | 128 |
| 129 // Starts the test in |list_value|[0] with the runAsync wrapper. | 129 // Starts the test in |list_value|[0] with the runAsync wrapper. |
| 130 void HandleStartAsyncTest(const base::ListValue* list_value) { | 130 void HandleStartAsyncTest(const base::ListValue* list_value) { |
| 131 const base::Value* test_name; | 131 const base::Value* test_name; |
| 132 ASSERT_TRUE(list_value->Get(0, &test_name)); | 132 ASSERT_TRUE(list_value->Get(0, &test_name)); |
| 133 web_ui()->CallJavascriptFunction("runAsync", *test_name); | 133 web_ui()->CallJavascriptFunctionUnsafe("runAsync", *test_name); |
| 134 } | 134 } |
| 135 | 135 |
| 136 DISALLOW_COPY_AND_ASSIGN(AsyncWebUIMessageHandler); | 136 DISALLOW_COPY_AND_ASSIGN(AsyncWebUIMessageHandler); |
| 137 }; | 137 }; |
| 138 | 138 |
| 139 // Handler for this object. | 139 // Handler for this object. |
| 140 ::testing::StrictMock<AsyncWebUIMessageHandler> message_handler_; | 140 ::testing::StrictMock<AsyncWebUIMessageHandler> message_handler_; |
| 141 | 141 |
| 142 private: | 142 private: |
| 143 // Provide this object's handler. | 143 // Provide this object's handler. |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 // testDone directly and expect pass result. | 239 // testDone directly and expect pass result. |
| 240 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPassesAsync) { | 240 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPassesAsync) { |
| 241 ASSERT_TRUE(RunJavascriptAsyncTest("testDone")); | 241 ASSERT_TRUE(RunJavascriptAsyncTest("testDone")); |
| 242 } | 242 } |
| 243 | 243 |
| 244 // Test that calling testDone during RunJavascriptTest still completes when | 244 // Test that calling testDone during RunJavascriptTest still completes when |
| 245 // waiting for async result. | 245 // waiting for async result. |
| 246 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPasses) { | 246 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPasses) { |
| 247 ASSERT_TRUE(RunJavascriptTest("testDone")); | 247 ASSERT_TRUE(RunJavascriptTest("testDone")); |
| 248 } | 248 } |
| OLD | NEW |