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 "chrome/browser/renderer_context_menu/render_view_context_menu.h" |
| 6 |
5 #include <string> | 7 #include <string> |
| 8 #include <utility> |
6 | 9 |
7 #include "base/bind.h" | 10 #include "base/bind.h" |
8 #include "base/command_line.h" | 11 #include "base/command_line.h" |
9 #include "base/macros.h" | 12 #include "base/macros.h" |
10 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
12 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
13 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
14 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
15 #include "build/build_config.h" | 18 #include "build/build_config.h" |
16 #include "chrome/app/chrome_command_ids.h" | 19 #include "chrome/app/chrome_command_ids.h" |
17 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
18 #include "chrome/browser/chrome_notification_types.h" | 21 #include "chrome/browser/chrome_notification_types.h" |
19 #include "chrome/browser/profiles/profile_window.h" | 22 #include "chrome/browser/profiles/profile_window.h" |
20 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" | |
21 #include "chrome/browser/renderer_context_menu/render_view_context_menu_browsert
est_util.h" | 23 #include "chrome/browser/renderer_context_menu/render_view_context_menu_browsert
est_util.h" |
22 #include "chrome/browser/renderer_context_menu/render_view_context_menu_test_uti
l.h" | 24 #include "chrome/browser/renderer_context_menu/render_view_context_menu_test_uti
l.h" |
23 #include "chrome/browser/search_engines/template_url_service_factory.h" | 25 #include "chrome/browser/search_engines/template_url_service_factory.h" |
24 #include "chrome/browser/ui/browser.h" | 26 #include "chrome/browser/ui/browser.h" |
25 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 27 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
26 #include "chrome/common/render_messages.h" | 28 #include "chrome/common/render_messages.h" |
27 #include "chrome/test/base/in_process_browser_test.h" | 29 #include "chrome/test/base/in_process_browser_test.h" |
28 #include "chrome/test/base/search_test_utils.h" | 30 #include "chrome/test/base/search_test_utils.h" |
29 #include "chrome/test/base/ui_test_utils.h" | 31 #include "chrome/test/base/ui_test_utils.h" |
30 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_switc
hes.h" | 32 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_switc
hes.h" |
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 IDC_CONTENT_CONTEXT_LOAD_ORIGINAL_IMAGE)); | 778 IDC_CONTENT_CONTEXT_LOAD_ORIGINAL_IMAGE)); |
777 content::WebContents* tab = | 779 content::WebContents* tab = |
778 browser()->tab_strip_model()->GetActiveWebContents(); | 780 browser()->tab_strip_model()->GetActiveWebContents(); |
779 content::SimulateMouseClickAt(tab, 0, blink::WebMouseEvent::ButtonRight, | 781 content::SimulateMouseClickAt(tab, 0, blink::WebMouseEvent::ButtonRight, |
780 gfx::Point(15, 15)); | 782 gfx::Point(15, 15)); |
781 } | 783 } |
782 | 784 |
783 void AddInterceptorForURL( | 785 void AddInterceptorForURL( |
784 const GURL& url, scoped_ptr<net::URLRequestInterceptor> handler) { | 786 const GURL& url, scoped_ptr<net::URLRequestInterceptor> handler) { |
785 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 787 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
786 net::URLRequestFilter::GetInstance()->AddUrlInterceptor( | 788 net::URLRequestFilter::GetInstance()->AddUrlInterceptor(url, |
787 url, handler.Pass()); | 789 std::move(handler)); |
788 } | 790 } |
789 | 791 |
790 LoadImageRequestInterceptor* interceptor_; | 792 LoadImageRequestInterceptor* interceptor_; |
791 | 793 |
792 private: | 794 private: |
793 scoped_ptr<ContextMenuNotificationObserver> menu_observer_; | 795 scoped_ptr<ContextMenuNotificationObserver> menu_observer_; |
794 }; | 796 }; |
795 | 797 |
796 IN_PROC_BROWSER_TEST_F(LoadImageBrowserTest, LoadImage) { | 798 IN_PROC_BROWSER_TEST_F(LoadImageBrowserTest, LoadImage) { |
797 static const char kValidImage[] = "/load_image/image.png"; | 799 static const char kValidImage[] = "/load_image/image.png"; |
798 SetupAndLoadImagePage(kValidImage); | 800 SetupAndLoadImagePage(kValidImage); |
799 AddLoadImageInterceptor(kValidImage); | 801 AddLoadImageInterceptor(kValidImage); |
800 AttemptLoadImage(); | 802 AttemptLoadImage(); |
801 interceptor_->WaitForRequests(1); | 803 interceptor_->WaitForRequests(1); |
802 EXPECT_EQ(1, interceptor_->num_requests()); | 804 EXPECT_EQ(1, interceptor_->num_requests()); |
803 } | 805 } |
804 | 806 |
805 } // namespace | 807 } // namespace |
OLD | NEW |