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

Unified Diff: chrome/browser/renderer_context_menu/render_view_context_menu_unittest.cc

Issue 1105263004: "Load image" context menu item to reload a LoFi image. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: try again Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
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));
+}

Powered by Google App Engine
This is Rietveld 408576698