Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Side by Side Diff: headless/lib/headless_browser_browsertest.cc

Issue 2394463002: headless: Fix two issues that are making the bot red (Closed)
Patch Set: Allow IO in a different way Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « headless/lib/browser/headless_web_contents_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 <memory> 5 #include <memory>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
11 #include "base/threading/thread_restrictions.h"
11 #include "content/public/test/browser_test.h" 12 #include "content/public/test/browser_test.h"
12 #include "headless/public/domains/network.h" 13 #include "headless/public/domains/network.h"
13 #include "headless/public/domains/page.h" 14 #include "headless/public/domains/page.h"
14 #include "headless/public/headless_browser.h" 15 #include "headless/public/headless_browser.h"
15 #include "headless/public/headless_devtools_client.h" 16 #include "headless/public/headless_devtools_client.h"
16 #include "headless/public/headless_devtools_target.h" 17 #include "headless/public/headless_devtools_target.h"
17 #include "headless/public/headless_web_contents.h" 18 #include "headless/public/headless_web_contents.h"
18 #include "headless/test/headless_browser_test.h" 19 #include "headless/test/headless_browser_test.h"
19 #include "headless/test/test_protocol_handler.h" 20 #include "headless/test/test_protocol_handler.h"
20 #include "headless/test/test_url_request_job.h" 21 #include "headless/test/test_url_request_job.h"
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 } 597 }
597 598
598 // TODO(skyostil): This test currently relies on being able to run a shell 599 // TODO(skyostil): This test currently relies on being able to run a shell
599 // script. 600 // script.
600 #if defined(OS_POSIX) 601 #if defined(OS_POSIX)
601 #define MAYBE_RendererCommandPrefixTest RendererCommandPrefixTest 602 #define MAYBE_RendererCommandPrefixTest RendererCommandPrefixTest
602 #else 603 #else
603 #define MAYBE_RendererCommandPrefixTest DISABLED_RendererCommandPrefixTest 604 #define MAYBE_RendererCommandPrefixTest DISABLED_RendererCommandPrefixTest
604 #endif // defined(OS_POSIX) 605 #endif // defined(OS_POSIX)
605 IN_PROC_BROWSER_TEST_F(HeadlessBrowserTest, MAYBE_RendererCommandPrefixTest) { 606 IN_PROC_BROWSER_TEST_F(HeadlessBrowserTest, MAYBE_RendererCommandPrefixTest) {
607 base::ThreadRestrictions::SetIOAllowed(true);
606 base::FilePath launcher_stamp; 608 base::FilePath launcher_stamp;
607 base::CreateTemporaryFile(&launcher_stamp); 609 base::CreateTemporaryFile(&launcher_stamp);
608 610
609 base::FilePath launcher_script; 611 base::FilePath launcher_script;
610 FILE* launcher_file = base::CreateAndOpenTemporaryFile(&launcher_script); 612 FILE* launcher_file = base::CreateAndOpenTemporaryFile(&launcher_script);
611 fprintf(launcher_file, "#!/bin/sh\n"); 613 fprintf(launcher_file, "#!/bin/sh\n");
612 fprintf(launcher_file, "echo $@ > %s\n", launcher_stamp.value().c_str()); 614 fprintf(launcher_file, "echo $@ > %s\n", launcher_stamp.value().c_str());
613 fprintf(launcher_file, "exec $@\n"); 615 fprintf(launcher_file, "exec $@\n");
614 fclose(launcher_file); 616 fclose(launcher_file);
615 base::SetPosixFilePermissions(launcher_script, 617 base::SetPosixFilePermissions(launcher_script,
(...skipping 18 matching lines...) Expand all
634 // Make sure the launcher was invoked when starting the renderer. 636 // Make sure the launcher was invoked when starting the renderer.
635 std::string stamp; 637 std::string stamp;
636 EXPECT_TRUE(base::ReadFileToString(launcher_stamp, &stamp)); 638 EXPECT_TRUE(base::ReadFileToString(launcher_stamp, &stamp));
637 EXPECT_GE(stamp.find("--type=renderer"), 0u); 639 EXPECT_GE(stamp.find("--type=renderer"), 0u);
638 640
639 base::DeleteFile(launcher_script, false); 641 base::DeleteFile(launcher_script, false);
640 base::DeleteFile(launcher_stamp, false); 642 base::DeleteFile(launcher_stamp, false);
641 } 643 }
642 644
643 } // namespace headless 645 } // namespace headless
OLDNEW
« no previous file with comments | « headless/lib/browser/headless_web_contents_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698