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

Side by Side Diff: content/public/test/browser_test_utils.h

Issue 2423983002: Limit PDF helper extension to print preview only (Closed)
Patch Set: 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 | « chrome/browser/resources/pdf/pdf.js ('k') | content/public/test/browser_test_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ 5 #ifndef CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_
6 #define CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ 6 #define CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_
7 7
8 #include <queue> 8 #include <queue>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/files/scoped_temp_dir.h" 14 #include "base/files/scoped_temp_dir.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
17 #include "base/process/process.h" 17 #include "base/process/process.h"
18 #include "base/strings/string16.h" 18 #include "base/strings/string16.h"
19 #include "build/build_config.h" 19 #include "build/build_config.h"
20 #include "cc/output/compositor_frame.h" 20 #include "cc/output/compositor_frame.h"
21 #include "content/public/browser/browser_message_filter.h" 21 #include "content/public/browser/browser_message_filter.h"
22 #include "content/public/browser/notification_observer.h" 22 #include "content/public/browser/notification_observer.h"
23 #include "content/public/browser/notification_registrar.h" 23 #include "content/public/browser/notification_registrar.h"
24 #include "content/public/browser/render_process_host_observer.h" 24 #include "content/public/browser/render_process_host_observer.h"
25 #include "content/public/browser/web_contents_delegate.h"
25 #include "content/public/browser/web_contents_observer.h" 26 #include "content/public/browser/web_contents_observer.h"
26 #include "content/public/common/page_type.h" 27 #include "content/public/common/page_type.h"
27 #include "ipc/message_filter.h" 28 #include "ipc/message_filter.h"
28 #include "third_party/WebKit/public/web/WebInputEvent.h" 29 #include "third_party/WebKit/public/web/WebInputEvent.h"
29 #include "ui/accessibility/ax_node_data.h" 30 #include "ui/accessibility/ax_node_data.h"
30 #include "ui/accessibility/ax_tree_update.h" 31 #include "ui/accessibility/ax_tree_update.h"
31 #include "ui/events/keycodes/dom/dom_code.h" 32 #include "ui/events/keycodes/dom/dom_code.h"
32 #include "ui/events/keycodes/dom/dom_key.h" 33 #include "ui/events/keycodes/dom/dom_key.h"
33 #include "ui/events/keycodes/keyboard_codes.h" 34 #include "ui/events/keycodes/keyboard_codes.h"
34 #include "url/gurl.h" 35 #include "url/gurl.h"
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 NavigationHandle* handle_; 641 NavigationHandle* handle_;
641 bool handled_navigation_; 642 bool handled_navigation_;
642 scoped_refptr<MessageLoopRunner> will_start_loop_runner_; 643 scoped_refptr<MessageLoopRunner> will_start_loop_runner_;
643 scoped_refptr<MessageLoopRunner> did_finish_loop_runner_; 644 scoped_refptr<MessageLoopRunner> did_finish_loop_runner_;
644 645
645 base::WeakPtrFactory<TestNavigationManager> weak_factory_; 646 base::WeakPtrFactory<TestNavigationManager> weak_factory_;
646 647
647 DISALLOW_COPY_AND_ASSIGN(TestNavigationManager); 648 DISALLOW_COPY_AND_ASSIGN(TestNavigationManager);
648 }; 649 };
649 650
651 // A WebContentsDelegate that catches messages sent to the console.
652 class ConsoleObserverDelegate : public WebContentsDelegate {
653 public:
654 ConsoleObserverDelegate(WebContents* web_contents, const std::string& filter);
655 ~ConsoleObserverDelegate() override;
656
657 // WebContentsDelegate method:
658 bool AddMessageToConsole(WebContents* source,
659 int32_t level,
660 const base::string16& message,
661 int32_t line_no,
662 const base::string16& source_id) override;
663
664 // Returns the most recent message sent to the console.
665 std::string message() { return message_; }
666
667 // Waits for the next message captured by the filter to be sent to the
668 // console.
669 void Wait();
670
671 private:
672 WebContents* web_contents_;
673 std::string filter_;
674 std::string message_;
675
676 // The MessageLoopRunner used to spin the message loop.
677 scoped_refptr<MessageLoopRunner> message_loop_runner_;
678
679 DISALLOW_COPY_AND_ASSIGN(ConsoleObserverDelegate);
680 };
681
650 } // namespace content 682 } // namespace content
651 683
652 #endif // CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ 684 #endif // CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_
OLDNEW
« no previous file with comments | « chrome/browser/resources/pdf/pdf.js ('k') | content/public/test/browser_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698