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" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "chrome/common/chrome_switches.h" | 12 #include "chrome/common/chrome_switches.h" |
13 #include "chrome/common/url_constants.h" | 13 #include "chrome/common/url_constants.h" |
14 #include "chrome/test/base/ui_test_utils.h" | 14 #include "chrome/test/base/ui_test_utils.h" |
15 #include "chrome/test/base/web_ui_browser_test.h" | 15 #include "chrome/test/base/web_ui_browser_test.h" |
16 #include "content/public/browser/web_ui.h" | 16 #include "content/public/browser/web_ui.h" |
17 #include "content/public/browser/web_ui_message_handler.h" | 17 #include "content/public/browser/web_ui_message_handler.h" |
18 #include "testing/gmock/include/gmock/gmock.h" | 18 #include "testing/gmock/include/gmock/gmock.h" |
19 #include "testing/gtest/include/gtest/gtest-spi.h" | 19 #include "testing/gtest/include/gtest/gtest-spi.h" |
20 | 20 |
21 using content::WebUIMessageHandler; | 21 using content::WebUIMessageHandler; |
22 | 22 |
23 // According to the interface for EXPECT_FATAL_FAILURE | 23 // According to the interface for EXPECT_FATAL_FAILURE |
24 // (http://code.google.com/p/googletest/wiki/AdvancedGuide#Catching_Failures) | 24 // (https://github.com/google/googletest/blob/master/googletest/docs/AdvancedGui
de.md#catching-failures) |
25 // the statement must be statically available. Therefore, we make a static | 25 // the statement must be statically available. Therefore, we make a static |
26 // global s_test_ which should point to |this| for the duration of the test run | 26 // global s_test_ which should point to |this| for the duration of the test run |
27 // and be cleared afterward. | 27 // and be cleared afterward. |
28 class WebUIBrowserExpectFailTest : public WebUIBrowserTest { | 28 class WebUIBrowserExpectFailTest : public WebUIBrowserTest { |
29 public: | 29 public: |
30 WebUIBrowserExpectFailTest() { | 30 WebUIBrowserExpectFailTest() { |
31 EXPECT_FALSE(s_test_); | 31 EXPECT_FALSE(s_test_); |
32 s_test_ = this; | 32 s_test_ = this; |
33 } | 33 } |
34 | 34 |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 // testDone directly and expect pass result. | 246 // testDone directly and expect pass result. |
247 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPassesAsync) { | 247 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPassesAsync) { |
248 ASSERT_TRUE(RunJavascriptAsyncTest("testDone")); | 248 ASSERT_TRUE(RunJavascriptAsyncTest("testDone")); |
249 } | 249 } |
250 | 250 |
251 // Test that calling testDone during RunJavascriptTest still completes when | 251 // Test that calling testDone during RunJavascriptTest still completes when |
252 // waiting for async result. | 252 // waiting for async result. |
253 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPasses) { | 253 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPasses) { |
254 ASSERT_TRUE(RunJavascriptTest("testDone")); | 254 ASSERT_TRUE(RunJavascriptTest("testDone")); |
255 } | 255 } |
OLD | NEW |