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/values.h" | 9 #include "base/values.h" |
10 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 // global s_test_ which should point to |this| for the duration of the test run | 23 // global s_test_ which should point to |this| for the duration of the test run |
24 // and be cleared afterward. | 24 // and be cleared afterward. |
25 class WebUIBrowserExpectFailTest : public WebUIBrowserTest { | 25 class WebUIBrowserExpectFailTest : public WebUIBrowserTest { |
26 public: | 26 public: |
27 WebUIBrowserExpectFailTest() { | 27 WebUIBrowserExpectFailTest() { |
28 EXPECT_FALSE(s_test_); | 28 EXPECT_FALSE(s_test_); |
29 s_test_ = this; | 29 s_test_ = this; |
30 } | 30 } |
31 | 31 |
32 protected: | 32 protected: |
33 virtual ~WebUIBrowserExpectFailTest() { | 33 ~WebUIBrowserExpectFailTest() override { |
34 EXPECT_TRUE(s_test_); | 34 EXPECT_TRUE(s_test_); |
35 s_test_ = NULL; | 35 s_test_ = NULL; |
36 } | 36 } |
37 | 37 |
38 static void RunJavascriptTestNoReturn(const std::string& testname) { | 38 static void RunJavascriptTestNoReturn(const std::string& testname) { |
39 EXPECT_TRUE(s_test_); | 39 EXPECT_TRUE(s_test_); |
40 s_test_->RunJavascriptTest(testname); | 40 s_test_->RunJavascriptTest(testname); |
41 } | 41 } |
42 | 42 |
43 static void RunJavascriptAsyncTestNoReturn(const std::string& testname) { | 43 static void RunJavascriptAsyncTestNoReturn(const std::string& testname) { |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 // testDone directly and expect pass result. | 236 // testDone directly and expect pass result. |
237 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPassesAsync) { | 237 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPassesAsync) { |
238 ASSERT_TRUE(RunJavascriptAsyncTest("testDone")); | 238 ASSERT_TRUE(RunJavascriptAsyncTest("testDone")); |
239 } | 239 } |
240 | 240 |
241 // Test that calling testDone during RunJavascriptTest still completes when | 241 // Test that calling testDone during RunJavascriptTest still completes when |
242 // waiting for async result. | 242 // waiting for async result. |
243 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPasses) { | 243 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPasses) { |
244 ASSERT_TRUE(RunJavascriptTest("testDone")); | 244 ASSERT_TRUE(RunJavascriptTest("testDone")); |
245 } | 245 } |
OLD | NEW |