| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/browser_commands.h" | 10 #include "chrome/browser/ui/browser_commands.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 if (severity == logging::LOG_ERROR && file && file == std::string("CONSOLE")) | 35 if (severity == logging::LOG_ERROR && file && file == std::string("CONSOLE")) |
| 36 had_console_errors = true; | 36 had_console_errors = true; |
| 37 return false; | 37 return false; |
| 38 } | 38 } |
| 39 | 39 |
| 40 } // namespace | 40 } // namespace |
| 41 | 41 |
| 42 class NewTabUIBrowserTest : public InProcessBrowserTest { | 42 class NewTabUIBrowserTest : public InProcessBrowserTest { |
| 43 public: | 43 public: |
| 44 NewTabUIBrowserTest() { | 44 NewTabUIBrowserTest() { |
| 45 logging::SetLogMessageHandler(&HandleMessage); | 45 logging::PushLogMessageHandler(&HandleMessage); |
| 46 } | 46 } |
| 47 | 47 |
| 48 ~NewTabUIBrowserTest() override { logging::SetLogMessageHandler(NULL); } | 48 ~NewTabUIBrowserTest() override { logging::PopLogMessageHandler(); } |
| 49 | 49 |
| 50 void TearDown() override { | 50 void TearDown() override { |
| 51 InProcessBrowserTest::TearDown(); | 51 InProcessBrowserTest::TearDown(); |
| 52 ASSERT_FALSE(had_console_errors); | 52 ASSERT_FALSE(had_console_errors); |
| 53 } | 53 } |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 // Navigate to incognito NTP. Fails if there are console errors. | 56 // Navigate to incognito NTP. Fails if there are console errors. |
| 57 IN_PROC_BROWSER_TEST_F(NewTabUIBrowserTest, ShowIncognito) { | 57 IN_PROC_BROWSER_TEST_F(NewTabUIBrowserTest, ShowIncognito) { |
| 58 ui_test_utils::NavigateToURL(CreateIncognitoBrowser(), | 58 ui_test_utils::NavigateToURL(CreateIncognitoBrowser(), |
| (...skipping 27 matching lines...) Expand all Loading... |
| 86 | 86 |
| 87 // We don't use ui_test_utils::NavigateToURLWithDisposition because that waits | 87 // We don't use ui_test_utils::NavigateToURLWithDisposition because that waits |
| 88 // for current loading to stop. | 88 // for current loading to stop. |
| 89 content::TestNavigationObserver observer( | 89 content::TestNavigationObserver observer( |
| 90 browser()->tab_strip_model()->GetActiveWebContents()); | 90 browser()->tab_strip_model()->GetActiveWebContents()); |
| 91 browser()->OpenURL(OpenURLParams( | 91 browser()->OpenURL(OpenURLParams( |
| 92 GURL("data:text/html,hello world"), Referrer(), CURRENT_TAB, | 92 GURL("data:text/html,hello world"), Referrer(), CURRENT_TAB, |
| 93 ui::PAGE_TRANSITION_TYPED, false)); | 93 ui::PAGE_TRANSITION_TYPED, false)); |
| 94 observer.Wait(); | 94 observer.Wait(); |
| 95 } | 95 } |
| OLD | NEW |