| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/test/ppapi/ppapi_test.h" | 5 #include "chrome/test/ppapi/ppapi_test.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "content/public/browser/notification_service.h" | 26 #include "content/public/browser/notification_service.h" |
| 27 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
| 28 #include "content/public/common/content_switches.h" | 28 #include "content/public/common/content_switches.h" |
| 29 #include "content/public/test/ppapi_test_utils.h" | 29 #include "content/public/test/ppapi_test_utils.h" |
| 30 #include "media/base/media_switches.h" | 30 #include "media/base/media_switches.h" |
| 31 #include "net/base/filename_util.h" | 31 #include "net/base/filename_util.h" |
| 32 #include "net/base/test_data_directory.h" | 32 #include "net/base/test_data_directory.h" |
| 33 #include "ppapi/shared_impl/ppapi_switches.h" | 33 #include "ppapi/shared_impl/ppapi_switches.h" |
| 34 #include "ui/gl/gl_switches.h" | 34 #include "ui/gl/gl_switches.h" |
| 35 | 35 |
| 36 #if defined(OS_MACOSX) |
| 37 #include "media/base/mac/avfoundation_glue.h" |
| 38 #endif |
| 39 |
| 36 using content::DomOperationNotificationDetails; | 40 using content::DomOperationNotificationDetails; |
| 37 using content::RenderViewHost; | 41 using content::RenderViewHost; |
| 38 using content::TestMessageHandler; | 42 using content::TestMessageHandler; |
| 39 | 43 |
| 40 namespace { | 44 namespace { |
| 41 | 45 |
| 42 void AddPrivateSwitches(base::CommandLine* command_line) { | 46 void AddPrivateSwitches(base::CommandLine* command_line) { |
| 43 // For TestRequestOSFileHandle. | 47 // For TestRequestOSFileHandle. |
| 44 command_line->AppendSwitch(switches::kUnlimitedStorage); | 48 command_line->AppendSwitch(switches::kUnlimitedStorage); |
| 45 command_line->AppendSwitchASCII(switches::kAllowNaClFileHandleAPI, | 49 command_line->AppendSwitchASCII(switches::kAllowNaClFileHandleAPI, |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 void PPAPITestBase::SetUpCommandLine(base::CommandLine* command_line) { | 138 void PPAPITestBase::SetUpCommandLine(base::CommandLine* command_line) { |
| 135 // Some stuff is hung off of the testing interface which is not enabled | 139 // Some stuff is hung off of the testing interface which is not enabled |
| 136 // by default. | 140 // by default. |
| 137 command_line->AppendSwitch(switches::kEnablePepperTesting); | 141 command_line->AppendSwitch(switches::kEnablePepperTesting); |
| 138 | 142 |
| 139 // Smooth scrolling confuses the scrollbar test. | 143 // Smooth scrolling confuses the scrollbar test. |
| 140 command_line->AppendSwitch(switches::kDisableSmoothScrolling); | 144 command_line->AppendSwitch(switches::kDisableSmoothScrolling); |
| 141 } | 145 } |
| 142 | 146 |
| 143 void PPAPITestBase::SetUpOnMainThread() { | 147 void PPAPITestBase::SetUpOnMainThread() { |
| 148 #if defined(OS_MACOSX) |
| 149 AVFoundationGlue::InitializeAVFoundation(); |
| 150 #endif |
| 144 // Always allow access to the PPAPI broker. | 151 // Always allow access to the PPAPI broker. |
| 145 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( | 152 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( |
| 146 CONTENT_SETTINGS_TYPE_PPAPI_BROKER, CONTENT_SETTING_ALLOW); | 153 CONTENT_SETTINGS_TYPE_PPAPI_BROKER, CONTENT_SETTING_ALLOW); |
| 147 } | 154 } |
| 148 | 155 |
| 149 GURL PPAPITestBase::GetTestFileUrl(const std::string& test_case) { | 156 GURL PPAPITestBase::GetTestFileUrl(const std::string& test_case) { |
| 150 base::FilePath test_path; | 157 base::FilePath test_path; |
| 151 EXPECT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &test_path)); | 158 EXPECT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &test_path)); |
| 152 test_path = test_path.Append(FILE_PATH_LITERAL("ppapi")); | 159 test_path = test_path.Append(FILE_PATH_LITERAL("ppapi")); |
| 153 test_path = test_path.Append(FILE_PATH_LITERAL("tests")); | 160 test_path = test_path.Append(FILE_PATH_LITERAL("tests")); |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 const std::string& base, | 468 const std::string& base, |
| 462 const std::string& test_case) { | 469 const std::string& test_case) { |
| 463 return base::StringPrintf("%smode=nacl_newlib&testcase=%s", base.c_str(), | 470 return base::StringPrintf("%smode=nacl_newlib&testcase=%s", base.c_str(), |
| 464 test_case.c_str()); | 471 test_case.c_str()); |
| 465 } | 472 } |
| 466 | 473 |
| 467 void PPAPIBrokerInfoBarTest::SetUpOnMainThread() { | 474 void PPAPIBrokerInfoBarTest::SetUpOnMainThread() { |
| 468 // The default content setting for the PPAPI broker is ASK. We purposefully | 475 // The default content setting for the PPAPI broker is ASK. We purposefully |
| 469 // don't call PPAPITestBase::SetUpOnMainThread() to keep it that way. | 476 // don't call PPAPITestBase::SetUpOnMainThread() to keep it that way. |
| 470 } | 477 } |
| OLD | NEW |