Index: chrome/browser/renderer_context_menu/render_view_context_menu_unittest.cc |
diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu_unittest.cc b/chrome/browser/renderer_context_menu/render_view_context_menu_unittest.cc |
index c55c0ce901949cda79f7d9ad0c95c8d5cfe99656..66c8b7c820ed79e6b1a573485cbf85b4b67764c4 100644 |
--- a/chrome/browser/renderer_context_menu/render_view_context_menu_unittest.cc |
+++ b/chrome/browser/renderer_context_menu/render_view_context_menu_unittest.cc |
@@ -23,6 +23,7 @@ |
#include "chrome/test/base/chrome_render_view_host_test_harness.h" |
#include "chrome/test/base/testing_profile.h" |
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.h" |
+#include "components/data_reduction_proxy/core/common/data_reduction_proxy_headers.h" |
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_params.h" |
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_names.h" |
#include "content/public/browser/web_contents.h" |
@@ -356,6 +357,10 @@ class RenderViewContextMenuPrefsTest : public ChromeRenderViewHostTestHarness { |
return menu; |
} |
+ void AppendImageItems(TestRenderViewContextMenu* menu) { |
+ menu->AppendImageItems(); |
+ } |
+ |
void SetupDataReductionProxy(bool enable_data_reduction_proxy) { |
drp_test_context_ = |
data_reduction_proxy::DataReductionProxyTestContext::Builder() |
@@ -467,3 +472,19 @@ TEST_F(RenderViewContextMenuPrefsTest, DataSaverDisabledSaveImageAs) { |
std::string::npos && |
headers.find("Cache-Control: no-cache") == std::string::npos); |
} |
+ |
+// Verify that the Chrome-Proxy Lo-Fi directive causes the context menu to |
+// display the "Show Image" menu item. |
+TEST_F(RenderViewContextMenuPrefsTest, DataSaverShowImage) { |
+ SetupDataReductionProxy(true); |
+ content::ContextMenuParams params = CreateParams(MenuItem::IMAGE); |
+ params.properties[data_reduction_proxy::chrome_proxy_header()] = |
+ data_reduction_proxy::chrome_proxy_lo_fi_directive(); |
+ params.unfiltered_link_url = params.link_url; |
+ content::WebContents* wc = web_contents(); |
+ scoped_ptr<TestRenderViewContextMenu> menu( |
+ new TestRenderViewContextMenu(wc->GetMainFrame(), params)); |
+ AppendImageItems(menu.get()); |
+ |
+ ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_SHOW_ORIGINAL_IMAGE)); |
+} |