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

Side by Side Diff: chrome/browser/policy/policy_browsertest.cc

Issue 22723004: Get rid of webkit/plugins/plugin_constants.* and move them to content/public/common/content_constan… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/pepper_flash_settings_manager.cc ('k') | chrome/browser/ui/webui/flash_ui.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 #include <algorithm> 5 #include <algorithm>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 #include "content/public/browser/download_item.h" 87 #include "content/public/browser/download_item.h"
88 #include "content/public/browser/download_manager.h" 88 #include "content/public/browser/download_manager.h"
89 #include "content/public/browser/notification_registrar.h" 89 #include "content/public/browser/notification_registrar.h"
90 #include "content/public/browser/notification_service.h" 90 #include "content/public/browser/notification_service.h"
91 #include "content/public/browser/notification_source.h" 91 #include "content/public/browser/notification_source.h"
92 #include "content/public/browser/notification_types.h" 92 #include "content/public/browser/notification_types.h"
93 #include "content/public/browser/plugin_service.h" 93 #include "content/public/browser/plugin_service.h"
94 #include "content/public/browser/render_process_host.h" 94 #include "content/public/browser/render_process_host.h"
95 #include "content/public/browser/render_view_host.h" 95 #include "content/public/browser/render_view_host.h"
96 #include "content/public/browser/web_contents.h" 96 #include "content/public/browser/web_contents.h"
97 #include "content/public/common/content_constants.h"
97 #include "content/public/common/content_paths.h" 98 #include "content/public/common/content_paths.h"
98 #include "content/public/common/page_transition_types.h" 99 #include "content/public/common/page_transition_types.h"
99 #include "content/public/common/process_type.h" 100 #include "content/public/common/process_type.h"
100 #include "content/public/common/url_constants.h" 101 #include "content/public/common/url_constants.h"
101 #include "content/public/common/webplugininfo.h" 102 #include "content/public/common/webplugininfo.h"
102 #include "content/public/test/browser_test_utils.h" 103 #include "content/public/test/browser_test_utils.h"
103 #include "content/public/test/download_test_observer.h" 104 #include "content/public/test/download_test_observer.h"
104 #include "content/public/test/mock_notification_observer.h" 105 #include "content/public/test/mock_notification_observer.h"
105 #include "content/public/test/test_navigation_observer.h" 106 #include "content/public/test/test_navigation_observer.h"
106 #include "content/public/test/test_utils.h" 107 #include "content/public/test/test_utils.h"
107 #include "content/test/net/url_request_failed_job.h" 108 #include "content/test/net/url_request_failed_job.h"
108 #include "content/test/net/url_request_mock_http_job.h" 109 #include "content/test/net/url_request_mock_http_job.h"
109 #include "grit/generated_resources.h" 110 #include "grit/generated_resources.h"
110 #include "net/base/net_errors.h" 111 #include "net/base/net_errors.h"
111 #include "net/base/net_util.h" 112 #include "net/base/net_util.h"
112 #include "net/base/url_util.h" 113 #include "net/base/url_util.h"
113 #include "net/http/http_stream_factory.h" 114 #include "net/http/http_stream_factory.h"
114 #include "net/url_request/url_request.h" 115 #include "net/url_request/url_request.h"
115 #include "net/url_request/url_request_filter.h" 116 #include "net/url_request/url_request_filter.h"
116 #include "policy/policy_constants.h" 117 #include "policy/policy_constants.h"
117 #include "testing/gmock/include/gmock/gmock.h" 118 #include "testing/gmock/include/gmock/gmock.h"
118 #include "testing/gtest/include/gtest/gtest.h" 119 #include "testing/gtest/include/gtest/gtest.h"
119 #include "third_party/WebKit/public/web/WebInputEvent.h" 120 #include "third_party/WebKit/public/web/WebInputEvent.h"
120 #include "ui/base/l10n/l10n_util.h" 121 #include "ui/base/l10n/l10n_util.h"
121 #include "ui/base/resource/resource_bundle.h" 122 #include "ui/base/resource/resource_bundle.h"
122 #include "url/gurl.h" 123 #include "url/gurl.h"
123 #include "webkit/plugins/plugin_constants.h"
124 124
125 #if defined(OS_CHROMEOS) 125 #if defined(OS_CHROMEOS)
126 #include "ash/accelerators/accelerator_controller.h" 126 #include "ash/accelerators/accelerator_controller.h"
127 #include "ash/accelerators/accelerator_table.h" 127 #include "ash/accelerators/accelerator_table.h"
128 #include "ash/magnifier/magnifier_constants.h" 128 #include "ash/magnifier/magnifier_constants.h"
129 #include "ash/shell.h" 129 #include "ash/shell.h"
130 #include "ash/shell_delegate.h" 130 #include "ash/shell_delegate.h"
131 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" 131 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
132 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" 132 #include "chrome/browser/chromeos/accessibility/magnification_manager.h"
133 #include "chromeos/audio/cras_audio_handler.h" 133 #include "chromeos/audio/cras_audio_handler.h"
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 void GetPluginList(std::vector<content::WebPluginInfo>* plugins) { 351 void GetPluginList(std::vector<content::WebPluginInfo>* plugins) {
352 content::PluginService* service = content::PluginService::GetInstance(); 352 content::PluginService* service = content::PluginService::GetInstance();
353 service->GetPlugins(base::Bind(CopyPluginListAndQuit, plugins)); 353 service->GetPlugins(base::Bind(CopyPluginListAndQuit, plugins));
354 content::RunMessageLoop(); 354 content::RunMessageLoop();
355 } 355 }
356 356
357 const content::WebPluginInfo* GetFlashPlugin( 357 const content::WebPluginInfo* GetFlashPlugin(
358 const std::vector<content::WebPluginInfo>& plugins) { 358 const std::vector<content::WebPluginInfo>& plugins) {
359 const content::WebPluginInfo* flash = NULL; 359 const content::WebPluginInfo* flash = NULL;
360 for (size_t i = 0; i < plugins.size(); ++i) { 360 for (size_t i = 0; i < plugins.size(); ++i) {
361 if (plugins[i].name == ASCIIToUTF16(kFlashPluginName)) { 361 if (plugins[i].name == ASCIIToUTF16(content::kFlashPluginName)) {
362 flash = &plugins[i]; 362 flash = &plugins[i];
363 break; 363 break;
364 } 364 }
365 } 365 }
366 #if defined(OFFICIAL_BUILD) 366 #if defined(OFFICIAL_BUILD)
367 // Official builds bundle Flash. 367 // Official builds bundle Flash.
368 EXPECT_TRUE(flash); 368 EXPECT_TRUE(flash);
369 #else 369 #else
370 if (!flash) 370 if (!flash)
371 LOG(INFO) << "Test skipped because the Flash plugin couldn't be found."; 371 LOG(INFO) << "Test skipped because the Flash plugin couldn't be found.";
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 if (!flash) 1136 if (!flash)
1137 return; 1137 return;
1138 PluginPrefs* plugin_prefs = 1138 PluginPrefs* plugin_prefs =
1139 PluginPrefs::GetForProfile(browser()->profile()).get(); 1139 PluginPrefs::GetForProfile(browser()->profile()).get();
1140 EXPECT_TRUE(plugin_prefs->IsPluginEnabled(*flash)); 1140 EXPECT_TRUE(plugin_prefs->IsPluginEnabled(*flash));
1141 1141
1142 // The user disables it and then a policy forces it to be enabled. 1142 // The user disables it and then a policy forces it to be enabled.
1143 EXPECT_TRUE(SetPluginEnabled(plugin_prefs, flash, false)); 1143 EXPECT_TRUE(SetPluginEnabled(plugin_prefs, flash, false));
1144 EXPECT_FALSE(plugin_prefs->IsPluginEnabled(*flash)); 1144 EXPECT_FALSE(plugin_prefs->IsPluginEnabled(*flash));
1145 base::ListValue plugin_list; 1145 base::ListValue plugin_list;
1146 plugin_list.Append(base::Value::CreateStringValue(kFlashPluginName)); 1146 plugin_list.Append(base::Value::CreateStringValue(content::kFlashPluginName));
1147 PolicyMap policies; 1147 PolicyMap policies;
1148 policies.Set(key::kEnabledPlugins, POLICY_LEVEL_MANDATORY, 1148 policies.Set(key::kEnabledPlugins, POLICY_LEVEL_MANDATORY,
1149 POLICY_SCOPE_USER, plugin_list.DeepCopy(), NULL); 1149 POLICY_SCOPE_USER, plugin_list.DeepCopy(), NULL);
1150 UpdateProviderPolicy(policies); 1150 UpdateProviderPolicy(policies);
1151 EXPECT_TRUE(plugin_prefs->IsPluginEnabled(*flash)); 1151 EXPECT_TRUE(plugin_prefs->IsPluginEnabled(*flash));
1152 // The user can't disable it anymore. 1152 // The user can't disable it anymore.
1153 EXPECT_FALSE(SetPluginEnabled(plugin_prefs, flash, false)); 1153 EXPECT_FALSE(SetPluginEnabled(plugin_prefs, flash, false));
1154 EXPECT_TRUE(plugin_prefs->IsPluginEnabled(*flash)); 1154 EXPECT_TRUE(plugin_prefs->IsPluginEnabled(*flash));
1155 1155
1156 // When a plugin is both enabled and disabled, the whitelist takes precedence. 1156 // When a plugin is both enabled and disabled, the whitelist takes precedence.
(...skipping 1389 matching lines...) Expand 10 before | Expand all | Expand 10 after
2546 chrome_variations::VariationsService::GetVariationsServerURL( 2546 chrome_variations::VariationsService::GetVariationsServerURL(
2547 g_browser_process->local_state()); 2547 g_browser_process->local_state());
2548 EXPECT_TRUE(StartsWithASCII(url.spec(), default_variations_url, true)); 2548 EXPECT_TRUE(StartsWithASCII(url.spec(), default_variations_url, true));
2549 std::string value; 2549 std::string value;
2550 EXPECT_TRUE(net::GetValueForKeyInQuery(url, "restrict", &value)); 2550 EXPECT_TRUE(net::GetValueForKeyInQuery(url, "restrict", &value));
2551 EXPECT_EQ("restricted", value); 2551 EXPECT_EQ("restricted", value);
2552 } 2552 }
2553 #endif 2553 #endif
2554 2554
2555 } // namespace policy 2555 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/pepper_flash_settings_manager.cc ('k') | chrome/browser/ui/webui/flash_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698