Index: chrome/test/ppapi/ppapi_test.cc |
diff --git a/chrome/test/ppapi/ppapi_test.cc b/chrome/test/ppapi/ppapi_test.cc |
index f1a77406924e9526d7c3d91098071cd9e875f5a8..b443cb01970b67bcf049c1522a0a8f9e7a26ed1e 100644 |
--- a/chrome/test/ppapi/ppapi_test.cc |
+++ b/chrome/test/ppapi/ppapi_test.cc |
@@ -12,14 +12,21 @@ |
#include "base/string_util.h" |
#include "base/test/test_timeouts.h" |
#include "build/build_config.h" |
+#include "chrome/browser/content_settings/host_content_settings_map.h" |
+#include "chrome/browser/infobars/infobar.h" |
+#include "chrome/browser/infobars/infobar_tab_helper.h" |
+#include "chrome/browser/profiles/profile.h" |
+#include "chrome/browser/tab_contents/confirm_infobar_delegate.h" |
#include "chrome/browser/ui/browser.h" |
#include "chrome/browser/ui/browser_tabstrip.h" |
+#include "chrome/common/chrome_notification_types.h" |
#include "chrome/common/chrome_paths.h" |
#include "chrome/common/chrome_switches.h" |
#include "chrome/test/base/test_launcher_utils.h" |
#include "chrome/test/base/ui_test_utils.h" |
#include "content/public/browser/dom_operation_notification_details.h" |
#include "content/public/test/test_renderer_host.h" |
+#include "content/public/browser/notification_service.h" |
#include "content/public/browser/notification_types.h" |
#include "content/public/browser/web_contents.h" |
#include "content/public/common/content_paths.h" |
@@ -107,7 +114,32 @@ void PPAPITestBase::TestFinishObserver::Reset() { |
} |
void PPAPITestBase::TestFinishObserver::OnTimeout() { |
- MessageLoopForUI::current()->Quit(); |
+ // MessageLoopForUI::current()->Quit(); |
+} |
+ |
+PPAPITestBase::InfoBarObserver::InfoBarObserver() { |
+ registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, |
+ content::NotificationService::AllSources()); |
+} |
+ |
+PPAPITestBase::InfoBarObserver::~InfoBarObserver() {} |
+ |
+void PPAPITestBase::InfoBarObserver::Observe( |
+ int type, |
+ const content::NotificationSource& source, |
+ const content::NotificationDetails& details) { |
+ ASSERT_EQ(chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, type); |
+ InfoBarDelegate* info_bar_delegate = |
+ content::Details<InfoBarAddedDetails>(details).ptr(); |
+ ConfirmInfoBarDelegate* confirm_info_bar_delegate = |
+ info_bar_delegate->AsConfirmInfoBarDelegate(); |
+ ASSERT_TRUE(confirm_info_bar_delegate); |
+ if (ShouldAcceptInfoBar(confirm_info_bar_delegate)) |
+ confirm_info_bar_delegate->Accept(); |
+ else |
+ confirm_info_bar_delegate->Cancel(); |
+ |
+ // TODO(bauerb): We should close the infobar. |
} |
PPAPITestBase::PPAPITestBase() { |
@@ -134,6 +166,12 @@ void PPAPITestBase::SetUpCommandLine(CommandLine* command_line) { |
command_line->AppendSwitch(switches::kDisableSmoothScrolling); |
} |
+void PPAPITestBase::SetUpOnMainThread() { |
+ // Always allow access to the PPAPI broker. |
+ browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( |
+ CONTENT_SETTINGS_TYPE_PPAPI_BROKER, CONTENT_SETTING_ALLOW); |
+} |
+ |
GURL PPAPITestBase::GetTestFileUrl(const std::string& test_case) { |
FilePath test_path; |
EXPECT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &test_path)); |
@@ -377,3 +415,7 @@ std::string PPAPINaClTestDisallowedSockets::BuildQuery( |
test_case.c_str()); |
} |
+void PPAPIBrokerInfoBarTest::SetUpOnMainThread() { |
+ // The default content setting for the PPAPI broker is ASK. We purposefully |
+ // don't call PPAPITestBase::SetUpOnMainThread() to keep it that way. |
+} |