| 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/ui/page_info/permission_menu_model.h" | 5 #include "chrome/browser/ui/page_info/permission_menu_model.h" |
| 6 #include "chrome/test/base/testing_profile.h" | 6 #include "chrome/test/base/testing_profile.h" |
| 7 #include "content/public/test/test_browser_thread_bundle.h" | 7 #include "content/public/test/test_browser_thread_bundle.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "ui/base/l10n/l10n_util.h" | 9 #include "ui/base/l10n/l10n_util.h" |
| 10 | 10 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 permission.type = type; | 56 permission.type = type; |
| 57 permission.setting = CONTENT_SETTING_ALLOW; | 57 permission.setting = CONTENT_SETTING_ALLOW; |
| 58 permission.default_setting = CONTENT_SETTING_ALLOW; | 58 permission.default_setting = CONTENT_SETTING_ALLOW; |
| 59 permission.is_incognito = false; | 59 permission.is_incognito = false; |
| 60 PermissionMenuModel model(profile(), GURL("http://www.google.com"), | 60 PermissionMenuModel model(profile(), GURL("http://www.google.com"), |
| 61 permission, callback.callback()); | 61 permission, callback.callback()); |
| 62 EXPECT_EQ(2, model.GetItemCount()); | 62 EXPECT_EQ(2, model.GetItemCount()); |
| 63 } | 63 } |
| 64 } | 64 } |
| 65 | 65 |
| 66 TEST_F(PermissionMenuModelTest, TestAllowBlock) { | |
| 67 TestCallback callback; | |
| 68 PermissionMenuModel model(profile(), GURL("http://www.google.com"), | |
| 69 CONTENT_SETTING_ALLOW, callback.callback()); | |
| 70 EXPECT_EQ(2, model.GetItemCount()); | |
| 71 } | |
| 72 | |
| 73 TEST_F(PermissionMenuModelTest, TestIncognitoNotifications) { | 66 TEST_F(PermissionMenuModelTest, TestIncognitoNotifications) { |
| 74 TestCallback callback; | 67 TestCallback callback; |
| 75 PageInfoUI::PermissionInfo permission; | 68 PageInfoUI::PermissionInfo permission; |
| 76 permission.type = CONTENT_SETTINGS_TYPE_NOTIFICATIONS; | 69 permission.type = CONTENT_SETTINGS_TYPE_NOTIFICATIONS; |
| 77 permission.setting = CONTENT_SETTING_ASK; | 70 permission.setting = CONTENT_SETTING_ASK; |
| 78 permission.default_setting = CONTENT_SETTING_ASK; | 71 permission.default_setting = CONTENT_SETTING_ASK; |
| 79 | 72 |
| 80 permission.is_incognito = false; | 73 permission.is_incognito = false; |
| 81 PermissionMenuModel regular_model(profile(), GURL("https://www.google.com"), | 74 PermissionMenuModel regular_model(profile(), GURL("https://www.google.com"), |
| 82 permission, callback.callback()); | 75 permission, callback.callback()); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 97 permission.is_incognito = false; | 90 permission.is_incognito = false; |
| 98 PermissionMenuModel model(profile(), GURL("http://www.google.com"), | 91 PermissionMenuModel model(profile(), GURL("http://www.google.com"), |
| 99 permission, callback.callback()); | 92 permission, callback.callback()); |
| 100 EXPECT_EQ(2, model.GetItemCount()); | 93 EXPECT_EQ(2, model.GetItemCount()); |
| 101 | 94 |
| 102 permission.is_incognito = true; | 95 permission.is_incognito = true; |
| 103 PermissionMenuModel incognito_model(profile(), GURL("https://www.google.com"), | 96 PermissionMenuModel incognito_model(profile(), GURL("https://www.google.com"), |
| 104 permission, callback.callback()); | 97 permission, callback.callback()); |
| 105 EXPECT_EQ(2, incognito_model.GetItemCount()); | 98 EXPECT_EQ(2, incognito_model.GetItemCount()); |
| 106 } | 99 } |
| OLD | NEW |