| 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 14 matching lines...) Expand all Loading... |
| 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 |
| 35 // Disable new downloads UI as it is very very slow. https://crbug.com/526577 | |
| 36 // TODO(dbeam): remove this once the downloads UI is not slow. | |
| 37 void SetUpCommandLine(base::CommandLine* command_line) override { | |
| 38 WebUIBrowserTest::SetUpCommandLine(command_line); | |
| 39 command_line->AppendSwitch(switches::kDisableMaterialDesignDownloads); | |
| 40 } | |
| 41 | |
| 42 protected: | 35 protected: |
| 43 ~WebUIBrowserExpectFailTest() override { | 36 ~WebUIBrowserExpectFailTest() override { |
| 44 EXPECT_TRUE(s_test_); | 37 EXPECT_TRUE(s_test_); |
| 45 s_test_ = NULL; | 38 s_test_ = NULL; |
| 46 } | 39 } |
| 47 | 40 |
| 48 static void RunJavascriptTestNoReturn(const std::string& testname) { | 41 static void RunJavascriptTestNoReturn(const std::string& testname) { |
| 49 EXPECT_TRUE(s_test_); | 42 EXPECT_TRUE(s_test_); |
| 50 s_test_->RunJavascriptTest(testname); | 43 s_test_->RunJavascriptTest(testname); |
| 51 } | 44 } |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 // testDone directly and expect pass result. | 239 // testDone directly and expect pass result. |
| 247 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPassesAsync) { | 240 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPassesAsync) { |
| 248 ASSERT_TRUE(RunJavascriptAsyncTest("testDone")); | 241 ASSERT_TRUE(RunJavascriptAsyncTest("testDone")); |
| 249 } | 242 } |
| 250 | 243 |
| 251 // Test that calling testDone during RunJavascriptTest still completes when | 244 // Test that calling testDone during RunJavascriptTest still completes when |
| 252 // waiting for async result. | 245 // waiting for async result. |
| 253 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPasses) { | 246 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPasses) { |
| 254 ASSERT_TRUE(RunJavascriptTest("testDone")); | 247 ASSERT_TRUE(RunJavascriptTest("testDone")); |
| 255 } | 248 } |
| OLD | NEW |