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

Side by Side Diff: chrome/browser/ui/website_settings/permission_menu_model_unittest.cc

Issue 903683005: Always prompt for permission on fullscreen and mouse lock on file:// URLs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tweak unit test Created 5 years, 10 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
« no previous file with comments | « chrome/browser/ui/website_settings/permission_menu_model.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/ui/website_settings/permission_menu_model.h" 5 #include "chrome/browser/ui/website_settings/permission_menu_model.h"
6 #include "components/content_settings/core/common/content_settings.h" 6 #include "chrome/grit/generated_resources.h"
7 #include "components/content_settings/core/common/content_settings_types.h"
8 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
9 #include "url/gurl.h" 8 #include "ui/base/l10n/l10n_util.h"
10 9
11 namespace { 10 namespace {
12 11
13 class TestCallback { 12 class TestCallback {
14 public: 13 public:
15 TestCallback() : current_(-1) {} 14 TestCallback() : current_(-1) {}
16 15
17 PermissionMenuModel::ChangeCallback callback() { 16 PermissionMenuModel::ChangeCallback callback() {
18 return base::Bind(&TestCallback::PermissionChanged, base::Unretained(this)); 17 return base::Bind(&TestCallback::PermissionChanged, base::Unretained(this));
19 } 18 }
(...skipping 28 matching lines...) Expand all
48 EXPECT_EQ(2, model.GetItemCount()); 47 EXPECT_EQ(2, model.GetItemCount());
49 } 48 }
50 49
51 TEST(PermissionMenuModelTest, TestAllowBlock) { 50 TEST(PermissionMenuModelTest, TestAllowBlock) {
52 TestCallback callback; 51 TestCallback callback;
53 PermissionMenuModel model(GURL("http://www.google.com"), 52 PermissionMenuModel model(GURL("http://www.google.com"),
54 CONTENT_SETTING_ALLOW, 53 CONTENT_SETTING_ALLOW,
55 callback.callback()); 54 callback.callback());
56 EXPECT_EQ(2, model.GetItemCount()); 55 EXPECT_EQ(2, model.GetItemCount());
57 } 56 }
57
58 TEST(PermissionMenuModelTest, TestFullscreenMouseLockFileUrl) {
59 TestCallback callback;
60 WebsiteSettingsUI::PermissionInfo permission;
61 permission.type = CONTENT_SETTINGS_TYPE_FULLSCREEN;
62 permission.setting = CONTENT_SETTING_ASK;
63 permission.default_setting = CONTENT_SETTING_ASK;
64 PermissionMenuModel fullscreen_model(GURL("file:///test.html"), permission,
65 callback.callback());
66 EXPECT_EQ(1, fullscreen_model.GetItemCount());
67 EXPECT_EQ(
68 l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_MENU_ITEM_DEFAULT_ASK),
69 fullscreen_model.GetLabelAt(0));
70
71 permission.type = CONTENT_SETTINGS_TYPE_MOUSELOCK;
72 PermissionMenuModel mouselock_model(GURL("file:///test.html"), permission,
73 callback.callback());
74 EXPECT_EQ(1, mouselock_model.GetItemCount());
75 EXPECT_EQ(
76 l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_MENU_ITEM_DEFAULT_ASK),
77 fullscreen_model.GetLabelAt(0));
78 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/website_settings/permission_menu_model.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698