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

Side by Side Diff: chrome/browser/notifications/platform_notification_service_interactive_uitest.cc

Issue 1943963004: Revert of (reland) Move permission.mojom from WebKit/public/platform/ to components/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
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 <memory> 5 #include <memory>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/path_service.h" 11 #include "base/path_service.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "chrome/browser/notifications/desktop_notification_profile_util.h" 14 #include "chrome/browser/notifications/desktop_notification_profile_util.h"
15 #include "chrome/browser/notifications/message_center_display_service.h" 15 #include "chrome/browser/notifications/message_center_display_service.h"
16 #include "chrome/browser/notifications/notification.h" 16 #include "chrome/browser/notifications/notification.h"
17 #include "chrome/browser/notifications/notification_test_util.h" 17 #include "chrome/browser/notifications/notification_test_util.h"
18 #include "chrome/browser/notifications/platform_notification_service_impl.h" 18 #include "chrome/browser/notifications/platform_notification_service_impl.h"
19 #include "chrome/browser/permissions/permission_manager.h" 19 #include "chrome/browser/permissions/permission_manager.h"
20 #include "chrome/browser/ui/browser.h" 20 #include "chrome/browser/ui/browser.h"
21 #include "chrome/browser/ui/tabs/tab_strip_model.h" 21 #include "chrome/browser/ui/tabs/tab_strip_model.h"
22 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" 22 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
23 #include "chrome/grit/generated_resources.h" 23 #include "chrome/grit/generated_resources.h"
24 #include "chrome/test/base/in_process_browser_test.h" 24 #include "chrome/test/base/in_process_browser_test.h"
25 #include "chrome/test/base/ui_test_utils.h" 25 #include "chrome/test/base/ui_test_utils.h"
26 #include "components/permissions/permission_status.mojom.h"
27 #include "content/public/browser/permission_type.h" 26 #include "content/public/browser/permission_type.h"
28 #include "content/public/common/content_switches.h" 27 #include "content/public/common/content_switches.h"
29 #include "content/public/test/browser_test_utils.h" 28 #include "content/public/test/browser_test_utils.h"
30 #include "net/base/filename_util.h" 29 #include "net/base/filename_util.h"
31 #include "net/test/embedded_test_server/embedded_test_server.h" 30 #include "net/test/embedded_test_server/embedded_test_server.h"
32 #include "testing/gmock/include/gmock/gmock.h" 31 #include "testing/gmock/include/gmock/gmock.h"
32 #include "third_party/WebKit/public/platform/modules/permissions/permission_stat us.mojom.h"
33 #include "ui/base/l10n/l10n_util.h" 33 #include "ui/base/l10n/l10n_util.h"
34 34
35 // ----------------------------------------------------------------------------- 35 // -----------------------------------------------------------------------------
36 36
37 // Dimensions of the icon.png resource in the notification test data directory. 37 // Dimensions of the icon.png resource in the notification test data directory.
38 const int kIconWidth = 100; 38 const int kIconWidth = 100;
39 const int kIconHeight = 100; 39 const int kIconHeight = 100;
40 40
41 // The maximum width and height of badges. Oversized images are scaled down to 41 // The maximum width and height of badges. Oversized images are scaled down to
42 // these values. 42 // these values.
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 // TODO(felt): This DCHECKs when bubbles are enabled, when the file_url is 397 // TODO(felt): This DCHECKs when bubbles are enabled, when the file_url is
398 // persisted. crbug.com/502057 398 // persisted. crbug.com/502057
399 IN_PROC_BROWSER_TEST_F(PlatformNotificationServiceBrowserTest, 399 IN_PROC_BROWSER_TEST_F(PlatformNotificationServiceBrowserTest,
400 DISABLED_CheckFilePermissionNotGranted) { 400 DISABLED_CheckFilePermissionNotGranted) {
401 // This case should succeed because a normal page URL is used. 401 // This case should succeed because a normal page URL is used.
402 std::string script_result; 402 std::string script_result;
403 403
404 PermissionManager* permission_manager = 404 PermissionManager* permission_manager =
405 PermissionManager::Get(browser()->profile()); 405 PermissionManager::Get(browser()->profile());
406 406
407 EXPECT_EQ(permissions::mojom::PermissionStatus::ASK, 407 EXPECT_EQ(blink::mojom::PermissionStatus::ASK,
408 permission_manager->GetPermissionStatus( 408 permission_manager->GetPermissionStatus(
409 content::PermissionType::NOTIFICATIONS, TestPageUrl(), 409 content::PermissionType::NOTIFICATIONS, TestPageUrl(),
410 TestPageUrl())); 410 TestPageUrl()));
411 411
412 RequestAndAcceptPermission(); 412 RequestAndAcceptPermission();
413 EXPECT_EQ(permissions::mojom::PermissionStatus::GRANTED, 413 EXPECT_EQ(blink::mojom::PermissionStatus::GRANTED,
414 permission_manager->GetPermissionStatus( 414 permission_manager->GetPermissionStatus(
415 content::PermissionType::NOTIFICATIONS, TestPageUrl(), 415 content::PermissionType::NOTIFICATIONS, TestPageUrl(),
416 TestPageUrl())); 416 TestPageUrl()));
417 417
418 // This case should fail because a file URL is used. 418 // This case should fail because a file URL is used.
419 base::FilePath dir_source_root; 419 base::FilePath dir_source_root;
420 EXPECT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &dir_source_root)); 420 EXPECT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &dir_source_root));
421 base::FilePath full_file_path = 421 base::FilePath full_file_path =
422 dir_source_root.Append(server_root()).AppendASCII(kTestFileName); 422 dir_source_root.Append(server_root()).AppendASCII(kTestFileName);
423 GURL file_url(net::FilePathToFileURL(full_file_path)); 423 GURL file_url(net::FilePathToFileURL(full_file_path));
424 424
425 ui_test_utils::NavigateToURL(browser(), file_url); 425 ui_test_utils::NavigateToURL(browser(), file_url);
426 426
427 EXPECT_EQ(permissions::mojom::PermissionStatus::ASK, 427 EXPECT_EQ(blink::mojom::PermissionStatus::ASK,
428 permission_manager->GetPermissionStatus( 428 permission_manager->GetPermissionStatus(
429 content::PermissionType::NOTIFICATIONS, file_url, file_url)); 429 content::PermissionType::NOTIFICATIONS, file_url, file_url));
430 430
431 RequestAndAcceptPermission(); 431 RequestAndAcceptPermission();
432 EXPECT_EQ(permissions::mojom::PermissionStatus::ASK, 432 EXPECT_EQ(blink::mojom::PermissionStatus::ASK,
433 permission_manager->GetPermissionStatus( 433 permission_manager->GetPermissionStatus(
434 content::PermissionType::NOTIFICATIONS, file_url, file_url)) 434 content::PermissionType::NOTIFICATIONS, file_url, file_url))
435 << "If this test fails, you may have fixed a bug preventing file origins " 435 << "If this test fails, you may have fixed a bug preventing file origins "
436 << "from sending their origin from Blink; if so you need to update the " 436 << "from sending their origin from Blink; if so you need to update the "
437 << "display function for notification origins to show the file path."; 437 << "display function for notification origins to show the file path.";
438 } 438 }
439 439
440 IN_PROC_BROWSER_TEST_F(PlatformNotificationServiceBrowserTest, 440 IN_PROC_BROWSER_TEST_F(PlatformNotificationServiceBrowserTest,
441 DataUrlAsNotificationImage) { 441 DataUrlAsNotificationImage) {
442 ASSERT_NO_FATAL_FAILURE(GrantNotificationPermissionForTest()); 442 ASSERT_NO_FATAL_FAILURE(GrantNotificationPermissionForTest());
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 EXPECT_EQ("actionTitle2", base::UTF16ToUTF8(notification.buttons()[1].title)); 491 EXPECT_EQ("actionTitle2", base::UTF16ToUTF8(notification.buttons()[1].title));
492 492
493 notification.delegate()->ButtonClick(0); 493 notification.delegate()->ButtonClick(0);
494 ASSERT_TRUE(RunScript("GetMessageFromWorker()", &script_result)); 494 ASSERT_TRUE(RunScript("GetMessageFromWorker()", &script_result));
495 EXPECT_EQ("action_button_click actionId1", script_result); 495 EXPECT_EQ("action_button_click actionId1", script_result);
496 496
497 notification.delegate()->ButtonClick(1); 497 notification.delegate()->ButtonClick(1);
498 ASSERT_TRUE(RunScript("GetMessageFromWorker()", &script_result)); 498 ASSERT_TRUE(RunScript("GetMessageFromWorker()", &script_result));
499 EXPECT_EQ("action_button_click actionId2", script_result); 499 EXPECT_EQ("action_button_click actionId2", script_result);
500 } 500 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698