| 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 <map> | 5 #include <map> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "chrome/browser/infobars/infobar_service.h" | 12 #include "chrome/browser/infobars/infobar_service.h" |
| 13 #include "chrome/browser/notifications/notification_test_util.h" | 13 #include "chrome/browser/notifications/notification_test_util.h" |
| 14 #include "chrome/browser/notifications/platform_notification_service_impl.h" | 14 #include "chrome/browser/notifications/platform_notification_service_impl.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/push_messaging/push_messaging_application_id.h" |
| 17 #include "chrome/browser/push_messaging/push_messaging_constants.h" |
| 16 #include "chrome/browser/services/gcm/fake_gcm_profile_service.h" | 18 #include "chrome/browser/services/gcm/fake_gcm_profile_service.h" |
| 17 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" | 19 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" |
| 18 #include "chrome/browser/services/gcm/push_messaging_application_id.h" | |
| 19 #include "chrome/browser/services/gcm/push_messaging_constants.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/test/base/in_process_browser_test.h" | 22 #include "chrome/test/base/in_process_browser_test.h" |
| 23 #include "chrome/test/base/ui_test_utils.h" | 23 #include "chrome/test/base/ui_test_utils.h" |
| 24 #include "components/content_settings/core/browser/host_content_settings_map.h" | 24 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 25 #include "components/content_settings/core/common/content_settings.h" | 25 #include "components/content_settings/core/common/content_settings.h" |
| 26 #include "components/content_settings/core/common/content_settings_types.h" | 26 #include "components/content_settings/core/common/content_settings_types.h" |
| 27 #include "components/gcm_driver/gcm_client.h" | 27 #include "components/gcm_driver/gcm_client.h" |
| 28 #include "components/infobars/core/confirm_infobar_delegate.h" | 28 #include "components/infobars/core/confirm_infobar_delegate.h" |
| 29 #include "components/infobars/core/infobar.h" | 29 #include "components/infobars/core/infobar.h" |
| 30 #include "components/infobars/core/infobar_manager.h" | 30 #include "components/infobars/core/infobar_manager.h" |
| 31 #include "content/public/browser/web_contents.h" | 31 #include "content/public/browser/web_contents.h" |
| 32 #include "content/public/common/content_switches.h" | 32 #include "content/public/common/content_switches.h" |
| 33 #include "content/public/test/browser_test_utils.h" | 33 #include "content/public/test/browser_test_utils.h" |
| 34 #include "ui/base/window_open_disposition.h" | 34 #include "ui/base/window_open_disposition.h" |
| 35 | 35 |
| 36 #if defined(OS_ANDROID) | 36 #if defined(OS_ANDROID) |
| 37 #include "base/android/build_info.h" | 37 #include "base/android/build_info.h" |
| 38 #endif | 38 #endif |
| 39 | 39 |
| 40 namespace gcm { | |
| 41 | |
| 42 namespace { | 40 namespace { |
| 43 // Responds to a confirm infobar by accepting or cancelling it. Responds to at | 41 // Responds to a confirm infobar by accepting or cancelling it. Responds to at |
| 44 // most one infobar. | 42 // most one infobar. |
| 45 class InfoBarResponder : public infobars::InfoBarManager::Observer { | 43 class InfoBarResponder : public infobars::InfoBarManager::Observer { |
| 46 public: | 44 public: |
| 47 InfoBarResponder(Browser* browser, bool accept) | 45 InfoBarResponder(Browser* browser, bool accept) |
| 48 : infobar_service_(InfoBarService::FromWebContents( | 46 : infobar_service_(InfoBarService::FromWebContents( |
| 49 browser->tab_strip_model()->GetActiveWebContents())), | 47 browser->tab_strip_model()->GetActiveWebContents())), |
| 50 accept_(accept), | 48 accept_(accept), |
| 51 has_observed_(false) { | 49 has_observed_(false) { |
| (...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1002 // if the rules it used to have have been reset. | 1000 // if the rules it used to have have been reset. |
| 1003 // The Push service should not unsubcribe |origin| because at no point it was | 1001 // The Push service should not unsubcribe |origin| because at no point it was |
| 1004 // left without permission to use Push. | 1002 // left without permission to use Push. |
| 1005 | 1003 |
| 1006 ASSERT_TRUE(RunScript("hasPermission()", &script_result)); | 1004 ASSERT_TRUE(RunScript("hasPermission()", &script_result)); |
| 1007 EXPECT_EQ("permission status - granted", script_result); | 1005 EXPECT_EQ("permission status - granted", script_result); |
| 1008 | 1006 |
| 1009 ASSERT_TRUE(RunScript("hasRegistration()", &script_result)); | 1007 ASSERT_TRUE(RunScript("hasRegistration()", &script_result)); |
| 1010 EXPECT_EQ("true - registered", script_result); | 1008 EXPECT_EQ("true - registered", script_result); |
| 1011 } | 1009 } |
| 1012 | |
| 1013 } // namespace gcm | |
| OLD | NEW |