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 <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
11 #include "base/location.h" | 11 #include "base/location.h" |
12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
13 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
15 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
| 16 #include "base/threading/thread_restrictions.h" |
16 #include "base/threading/thread_task_runner_handle.h" | 17 #include "base/threading/thread_task_runner_handle.h" |
17 #include "build/build_config.h" | 18 #include "build/build_config.h" |
18 #include "chrome/browser/chrome_notification_types.h" | 19 #include "chrome/browser/chrome_notification_types.h" |
19 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 20 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
20 #include "chrome/browser/infobars/infobar_service.h" | 21 #include "chrome/browser/infobars/infobar_service.h" |
21 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
22 #include "chrome/browser/ui/browser.h" | 23 #include "chrome/browser/ui/browser.h" |
23 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 24 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
24 #include "chrome/common/chrome_paths.h" | 25 #include "chrome/common/chrome_paths.h" |
25 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 } | 147 } |
147 | 148 |
148 void PPAPITestBase::SetUpOnMainThread() { | 149 void PPAPITestBase::SetUpOnMainThread() { |
149 // Always allow access to the PPAPI broker. | 150 // Always allow access to the PPAPI broker. |
150 HostContentSettingsMapFactory::GetForProfile(browser()->profile()) | 151 HostContentSettingsMapFactory::GetForProfile(browser()->profile()) |
151 ->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PPAPI_BROKER, | 152 ->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PPAPI_BROKER, |
152 CONTENT_SETTING_ALLOW); | 153 CONTENT_SETTING_ALLOW); |
153 } | 154 } |
154 | 155 |
155 GURL PPAPITestBase::GetTestFileUrl(const std::string& test_case) { | 156 GURL PPAPITestBase::GetTestFileUrl(const std::string& test_case) { |
| 157 base::ThreadRestrictions::ScopedAllowIO allow_io_for_test_setup; |
156 base::FilePath test_path; | 158 base::FilePath test_path; |
157 EXPECT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &test_path)); | 159 EXPECT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &test_path)); |
158 test_path = test_path.Append(FILE_PATH_LITERAL("ppapi")); | 160 test_path = test_path.Append(FILE_PATH_LITERAL("ppapi")); |
159 test_path = test_path.Append(FILE_PATH_LITERAL("tests")); | 161 test_path = test_path.Append(FILE_PATH_LITERAL("tests")); |
160 test_path = test_path.Append(FILE_PATH_LITERAL("test_case.html")); | 162 test_path = test_path.Append(FILE_PATH_LITERAL("test_case.html")); |
161 | 163 |
162 // Sanity check the file name. | 164 // Sanity check the file name. |
163 EXPECT_TRUE(base::PathExists(test_path)); | 165 EXPECT_TRUE(base::PathExists(test_path)); |
164 | 166 |
165 GURL test_url = net::FilePathToFileURL(test_path); | 167 GURL test_url = net::FilePathToFileURL(test_path); |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 const std::string& base, | 432 const std::string& base, |
431 const std::string& test_case) { | 433 const std::string& test_case) { |
432 return base::StringPrintf("%smode=nacl_newlib&testcase=%s", base.c_str(), | 434 return base::StringPrintf("%smode=nacl_newlib&testcase=%s", base.c_str(), |
433 test_case.c_str()); | 435 test_case.c_str()); |
434 } | 436 } |
435 | 437 |
436 void PPAPIBrokerInfoBarTest::SetUpOnMainThread() { | 438 void PPAPIBrokerInfoBarTest::SetUpOnMainThread() { |
437 // The default content setting for the PPAPI broker is ASK. We purposefully | 439 // The default content setting for the PPAPI broker is ASK. We purposefully |
438 // don't call PPAPITestBase::SetUpOnMainThread() to keep it that way. | 440 // don't call PPAPITestBase::SetUpOnMainThread() to keep it that way. |
439 } | 441 } |
OLD | NEW |