base: Change DCHECK_IS_ON to a macro DCHECK_IS_ON().
[chromium-blink-merge.git] / content / test / content_browser_test_test.cc
blob7b43385aa46b915764dee461951a5573eb5058f9
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "content/public/test/content_browser_test.h"
7 #include "base/command_line.h"
8 #include "base/strings/utf_string_conversions.h"
9 #include "content/public/common/content_switches.h"
10 #include "content/public/test/browser_test_utils.h"
11 #include "content/public/test/content_browser_test_utils.h"
12 #include "content/public/test/test_utils.h"
13 #include "content/shell/browser/shell.h"
14 #include "testing/gtest/include/gtest/gtest.h"
16 namespace content {
18 IN_PROC_BROWSER_TEST_F(ContentBrowserTest, MANUAL_ShouldntRun) {
19 // Ensures that tests with MANUAL_ prefix don't run automatically.
20 ASSERT_TRUE(false);
23 class ContentBrowserTestSanityTest : public ContentBrowserTest {
24 public:
25 void SetUpCommandLine(base::CommandLine* command_line) override {
26 const testing::TestInfo* const test_info =
27 testing::UnitTest::GetInstance()->current_test_info();
28 if (std::string(test_info->name()) == "SingleProcess")
29 command_line->AppendSwitch(switches::kSingleProcess);
32 void Test() {
33 GURL url = GetTestUrl(".", "simple_page.html");
35 base::string16 expected_title(base::ASCIIToUTF16("OK"));
36 TitleWatcher title_watcher(shell()->web_contents(), expected_title);
37 NavigateToURL(shell(), url);
38 base::string16 title = title_watcher.WaitAndGetTitle();
39 EXPECT_EQ(expected_title, title);
43 IN_PROC_BROWSER_TEST_F(ContentBrowserTestSanityTest, Basic) {
44 Test();
47 IN_PROC_BROWSER_TEST_F(ContentBrowserTestSanityTest, SingleProcess) {
48 Test();
51 namespace {
53 void CallbackChecker(bool* non_nested_task_ran) {
54 *non_nested_task_ran = true;
57 } // namespace
59 IN_PROC_BROWSER_TEST_F(ContentBrowserTestSanityTest, NonNestableTask) {
60 bool non_nested_task_ran = false;
61 base::MessageLoop::current()->PostNonNestableTask(
62 FROM_HERE, base::Bind(&CallbackChecker, &non_nested_task_ran));
63 content::RunAllPendingInMessageLoop();
64 ASSERT_TRUE(non_nested_task_ran);
67 } // namespace content