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 "chrome/browser/ui/webui/web_ui_browsertest.h" | 5 #include "chrome/browser/ui/webui/web_ui_browsertest.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 web_ui()->RegisterMessageCallback("testFails", | 580 web_ui()->RegisterMessageCallback("testFails", |
581 base::Bind(&AsyncWebUIMessageHandler::HandleTestFails, | 581 base::Bind(&AsyncWebUIMessageHandler::HandleTestFails, |
582 base::Unretained(this))); | 582 base::Unretained(this))); |
583 web_ui()->RegisterMessageCallback("testPasses", | 583 web_ui()->RegisterMessageCallback("testPasses", |
584 base::Bind(&AsyncWebUIMessageHandler::HandleTestPasses, | 584 base::Bind(&AsyncWebUIMessageHandler::HandleTestPasses, |
585 base::Unretained(this))); | 585 base::Unretained(this))); |
586 } | 586 } |
587 | 587 |
588 // Starts the test in |list_value|[0] with the runAsync wrapper. | 588 // Starts the test in |list_value|[0] with the runAsync wrapper. |
589 void HandleStartAsyncTest(const ListValue* list_value) { | 589 void HandleStartAsyncTest(const ListValue* list_value) { |
590 Value* test_name; | 590 const Value* test_name; |
591 ASSERT_TRUE(list_value->Get(0, &test_name)); | 591 ASSERT_TRUE(list_value->Get(0, &test_name)); |
592 web_ui()->CallJavascriptFunction("runAsync", *test_name); | 592 web_ui()->CallJavascriptFunction("runAsync", *test_name); |
593 } | 593 } |
594 | 594 |
595 DISALLOW_COPY_AND_ASSIGN(AsyncWebUIMessageHandler); | 595 DISALLOW_COPY_AND_ASSIGN(AsyncWebUIMessageHandler); |
596 }; | 596 }; |
597 | 597 |
598 // Handler for this object. | 598 // Handler for this object. |
599 ::testing::StrictMock<AsyncWebUIMessageHandler> message_handler_; | 599 ::testing::StrictMock<AsyncWebUIMessageHandler> message_handler_; |
600 | 600 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 // testDone directly and expect pass result. | 698 // testDone directly and expect pass result. |
699 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPassesAsync) { | 699 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPassesAsync) { |
700 ASSERT_TRUE(RunJavascriptAsyncTest("testDone")); | 700 ASSERT_TRUE(RunJavascriptAsyncTest("testDone")); |
701 } | 701 } |
702 | 702 |
703 // Test that calling testDone during RunJavascriptTest still completes when | 703 // Test that calling testDone during RunJavascriptTest still completes when |
704 // waiting for async result. | 704 // waiting for async result. |
705 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPasses) { | 705 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPasses) { |
706 ASSERT_TRUE(RunJavascriptTest("testDone")); | 706 ASSERT_TRUE(RunJavascriptTest("testDone")); |
707 } | 707 } |
OLD | NEW |