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

Unified Diff: chrome/browser/extensions/extension_content_settings_apitest.cc

Issue 10381097: Move content settings extension API to content_settings dir. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fixed conflict Created 8 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/extensions/extension_content_settings_apitest.cc
diff --git a/chrome/browser/extensions/extension_content_settings_apitest.cc b/chrome/browser/extensions/extension_content_settings_apitest.cc
deleted file mode 100644
index a593fa70f10816081c25a29d175e22b49c39e42a..0000000000000000000000000000000000000000
--- a/chrome/browser/extensions/extension_content_settings_apitest.cc
+++ /dev/null
@@ -1,131 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/utf_string_conversions.h"
-#include "chrome/browser/content_settings/cookie_settings.h"
-#include "chrome/browser/content_settings/host_content_settings_map.h"
-#include "chrome/browser/extensions/extension_apitest.h"
-#include "chrome/browser/extensions/extension_content_settings_api.h"
-#include "chrome/browser/prefs/pref_service.h"
-#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/browser.h"
-#include "chrome/common/chrome_switches.h"
-#include "chrome/common/pref_names.h"
-#include "webkit/plugins/npapi/mock_plugin_list.h"
-
-IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentSettings) {
- CommandLine::ForCurrentProcess()->AppendSwitch(
- switches::kEnableExperimentalExtensionApis);
-
- EXPECT_TRUE(RunExtensionTest("content_settings/standard")) << message_;
-
- HostContentSettingsMap* map =
- browser()->profile()->GetHostContentSettingsMap();
- CookieSettings* cookie_settings =
- CookieSettings::Factory::GetForProfile(browser()->profile());
-
- // Check default content settings by using an unknown URL.
- GURL example_url("http://www.example.com");
- EXPECT_TRUE(cookie_settings->IsReadingCookieAllowed(
- example_url, example_url));
- EXPECT_TRUE(cookie_settings->IsSettingCookieAllowed(
- example_url, example_url));
- EXPECT_TRUE(cookie_settings->IsCookieSessionOnly(example_url));
- EXPECT_EQ(CONTENT_SETTING_ALLOW,
- map->GetContentSetting(example_url,
- example_url,
- CONTENT_SETTINGS_TYPE_IMAGES,
- std::string()));
- EXPECT_EQ(CONTENT_SETTING_BLOCK,
- map->GetContentSetting(example_url,
- example_url,
- CONTENT_SETTINGS_TYPE_JAVASCRIPT,
- std::string()));
- EXPECT_EQ(CONTENT_SETTING_ALLOW,
- map->GetContentSetting(example_url,
- example_url,
- CONTENT_SETTINGS_TYPE_PLUGINS,
- std::string()));
- EXPECT_EQ(CONTENT_SETTING_BLOCK,
- map->GetContentSetting(example_url,
- example_url,
- CONTENT_SETTINGS_TYPE_POPUPS,
- std::string()));
-#if 0
- // TODO(bauerb): Enable once geolocation settings are integrated into the
- // HostContentSettingsMap.
- EXPECT_EQ(CONTENT_SETTING_ALLOW,
- map->GetContentSetting(example_url,
- example_url,
- CONTENT_SETTINGS_TYPE_GEOLOCATION,
- std::string()));
-#endif
- EXPECT_EQ(CONTENT_SETTING_ASK,
- map->GetContentSetting(example_url,
- example_url,
- CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
- std::string()));
-
- // Check content settings for www.google.com
- GURL url("http://www.google.com");
- EXPECT_FALSE(cookie_settings->IsReadingCookieAllowed(url, url));
- EXPECT_EQ(CONTENT_SETTING_ALLOW,
- map->GetContentSetting(
- url, url, CONTENT_SETTINGS_TYPE_IMAGES, ""));
- EXPECT_EQ(CONTENT_SETTING_BLOCK,
- map->GetContentSetting(
- url, url, CONTENT_SETTINGS_TYPE_JAVASCRIPT, ""));
- EXPECT_EQ(CONTENT_SETTING_BLOCK,
- map->GetContentSetting(
- url, url, CONTENT_SETTINGS_TYPE_PLUGINS, ""));
- EXPECT_EQ(CONTENT_SETTING_ALLOW,
- map->GetContentSetting(
- url, url, CONTENT_SETTINGS_TYPE_POPUPS, ""));
-#if 0
- EXPECT_EQ(CONTENT_SETTING_BLOCK,
- map->GetContentSetting(
- url, url, CONTENT_SETTINGS_TYPE_GEOLOCATION, ""));
-#endif
- EXPECT_EQ(CONTENT_SETTING_BLOCK,
- map->GetContentSetting(
- url, url, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, ""));
-}
-
-// Flaky on the trybots. See http://crbug.com/96725.
-IN_PROC_BROWSER_TEST_F(ExtensionApiTest,
- DISABLED_ContentSettingsGetResourceIdentifiers) {
- CommandLine::ForCurrentProcess()->AppendSwitch(
- switches::kEnableExperimentalExtensionApis);
-
- FilePath::CharType kFooPath[] = FILE_PATH_LITERAL("/plugins/foo.plugin");
- FilePath::CharType kBarPath[] = FILE_PATH_LITERAL("/plugins/bar.plugin");
- const char* kFooName = "Foo Plugin";
- const char* kBarName = "Bar Plugin";
- const webkit::npapi::PluginGroupDefinition kPluginDefinitions[] = {
- { "foo", "Foo", kFooName, NULL, 0 },
- };
-
- webkit::npapi::MockPluginList plugin_list(kPluginDefinitions,
- arraysize(kPluginDefinitions));
- plugin_list.AddPluginToLoad(
- webkit::WebPluginInfo(ASCIIToUTF16(kFooName),
- FilePath(kFooPath),
- ASCIIToUTF16("1.2.3"),
- ASCIIToUTF16("foo")));
- plugin_list.AddPluginToLoad(
- webkit::WebPluginInfo(ASCIIToUTF16(kBarName),
- FilePath(kBarPath),
- ASCIIToUTF16("2.3.4"),
- ASCIIToUTF16("bar")));
-
- std::vector<webkit::npapi::PluginGroup> groups;
- plugin_list.GetPluginGroups(true, &groups);
-
- GetResourceIdentifiersFunction::SetPluginGroupsForTesting(&groups);
-
- EXPECT_TRUE(RunExtensionTest("content_settings/getresourceidentifiers"))
- << message_;
-
- GetResourceIdentifiersFunction::SetPluginGroupsForTesting(NULL);
-}

Powered by Google App Engine
This is Rietveld 408576698