| 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" | 5 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" |
| 6 | 6 |
| 7 #include "base/prefs/pref_registry_simple.h" | 7 #include "base/prefs/pref_registry_simple.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 11 #include "base/thread_task_runner_handle.h" | 11 #include "base/thread_task_runner_handle.h" |
| 12 #include "chrome/app/chrome_command_ids.h" | 12 #include "chrome/app/chrome_command_ids.h" |
| 13 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 13 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
| 14 #include "chrome/browser/extensions/menu_manager.h" | 14 #include "chrome/browser/extensions/menu_manager.h" |
| 15 #include "chrome/browser/extensions/menu_manager_factory.h" | 15 #include "chrome/browser/extensions/menu_manager_factory.h" |
| 16 #include "chrome/browser/extensions/test_extension_environment.h" | 16 #include "chrome/browser/extensions/test_extension_environment.h" |
| 17 #include "chrome/browser/extensions/test_extension_prefs.h" | 17 #include "chrome/browser/extensions/test_extension_prefs.h" |
| 18 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" | 18 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" |
| 19 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact
ory.h" | 19 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact
ory.h" |
| 20 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 20 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 21 #include "chrome/browser/renderer_context_menu/render_view_context_menu_test_uti
l.h" | 21 #include "chrome/browser/renderer_context_menu/render_view_context_menu_test_uti
l.h" |
| 22 #include "chrome/common/pref_names.h" | |
| 23 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 22 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
| 24 #include "chrome/test/base/testing_profile.h" | 23 #include "chrome/test/base/testing_profile.h" |
| 25 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_test
_utils.h" | 24 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_test
_utils.h" |
| 26 #include "components/data_reduction_proxy/core/browser/data_store.h" | 25 #include "components/data_reduction_proxy/core/browser/data_store.h" |
| 27 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_heade
rs.h" | 26 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_heade
rs.h" |
| 28 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" | 27 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" |
| 29 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_
names.h" | 28 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_
names.h" |
| 29 #include "components/proxy_config/proxy_config_pref_names.h" |
| 30 #include "content/public/browser/web_contents.h" | 30 #include "content/public/browser/web_contents.h" |
| 31 #include "content/public/test/web_contents_tester.h" | 31 #include "content/public/test/web_contents_tester.h" |
| 32 | 32 |
| 33 #include "extensions/browser/extension_prefs.h" | 33 #include "extensions/browser/extension_prefs.h" |
| 34 #include "extensions/common/url_pattern.h" | 34 #include "extensions/common/url_pattern.h" |
| 35 #include "testing/gtest/include/gtest/gtest.h" | 35 #include "testing/gtest/include/gtest/gtest.h" |
| 36 #include "third_party/WebKit/public/web/WebContextMenuData.h" | 36 #include "third_party/WebKit/public/web/WebContextMenuData.h" |
| 37 #include "url/gurl.h" | 37 #include "url/gurl.h" |
| 38 | 38 |
| 39 using extensions::Extension; | 39 using extensions::Extension; |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 kFallbackAllowed | | 370 kFallbackAllowed | |
| 371 data_reduction_proxy::DataReductionProxyParams::kPromoAllowed) | 371 data_reduction_proxy::DataReductionProxyParams::kPromoAllowed) |
| 372 .WithMockConfig() | 372 .WithMockConfig() |
| 373 .SkipSettingsInitialization() | 373 .SkipSettingsInitialization() |
| 374 .Build(); | 374 .Build(); |
| 375 | 375 |
| 376 DataReductionProxyChromeSettings* settings = | 376 DataReductionProxyChromeSettings* settings = |
| 377 DataReductionProxyChromeSettingsFactory::GetForBrowserContext( | 377 DataReductionProxyChromeSettingsFactory::GetForBrowserContext( |
| 378 profile()); | 378 profile()); |
| 379 | 379 |
| 380 // TODO(bengr): Remove prefs::kProxy registration after M46. See | 380 // TODO(bengr): Remove proxy_config::prefs::kProxy registration after M46. |
| 381 // http://crbug.com/445599. | 381 // See http://crbug.com/445599. |
| 382 PrefRegistrySimple* registry = | 382 PrefRegistrySimple* registry = |
| 383 drp_test_context_->pref_service()->registry(); | 383 drp_test_context_->pref_service()->registry(); |
| 384 registry->RegisterDictionaryPref(prefs::kProxy); | 384 registry->RegisterDictionaryPref(proxy_config::prefs::kProxy); |
| 385 | 385 |
| 386 drp_test_context_->pref_service()->SetBoolean( | 386 drp_test_context_->pref_service()->SetBoolean( |
| 387 data_reduction_proxy::prefs::kDataReductionProxyEnabled, | 387 data_reduction_proxy::prefs::kDataReductionProxyEnabled, |
| 388 enable_data_reduction_proxy); | 388 enable_data_reduction_proxy); |
| 389 drp_test_context_->InitSettings(); | 389 drp_test_context_->InitSettings(); |
| 390 | 390 |
| 391 settings->InitDataReductionProxySettings( | 391 settings->InitDataReductionProxySettings( |
| 392 drp_test_context_->io_data(), drp_test_context_->pref_service(), | 392 drp_test_context_->io_data(), drp_test_context_->pref_service(), |
| 393 drp_test_context_->request_context_getter(), | 393 drp_test_context_->request_context_getter(), |
| 394 make_scoped_ptr(new data_reduction_proxy::DataStore()), | 394 make_scoped_ptr(new data_reduction_proxy::DataStore()), |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 params.unfiltered_link_url = params.link_url; | 497 params.unfiltered_link_url = params.link_url; |
| 498 content::WebContents* wc = web_contents(); | 498 content::WebContents* wc = web_contents(); |
| 499 scoped_ptr<TestRenderViewContextMenu> menu( | 499 scoped_ptr<TestRenderViewContextMenu> menu( |
| 500 new TestRenderViewContextMenu(wc->GetMainFrame(), params)); | 500 new TestRenderViewContextMenu(wc->GetMainFrame(), params)); |
| 501 AppendImageItems(menu.get()); | 501 AppendImageItems(menu.get()); |
| 502 | 502 |
| 503 ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_LOAD_ORIGINAL_IMAGE)); | 503 ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_LOAD_ORIGINAL_IMAGE)); |
| 504 | 504 |
| 505 DestroyDataReductionProxySettings(); | 505 DestroyDataReductionProxySettings(); |
| 506 } | 506 } |
| OLD | NEW |