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

Side by Side Diff: content/public/test/test_utils.cc

Issue 2946113002: Use FrameIsAd to decide whether to isolate a frame in TopDocumentIsolation mode. (Closed)
Patch Set: Rebasing on top of r486814 Created 3 years, 5 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
« no previous file with comments | « content/public/test/test_utils.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "content/public/test/test_utils.h" 5 #include "content/public/test/test_utils.h"
6 6
7 #include <map>
8 #include <set>
9 #include <string>
7 #include <utility> 10 #include <utility>
8 11
9 #include "base/bind.h" 12 #include "base/bind.h"
10 #include "base/command_line.h" 13 #include "base/command_line.h"
11 #include "base/location.h" 14 #include "base/location.h"
12 #include "base/macros.h" 15 #include "base/macros.h"
13 #include "base/message_loop/message_loop.h" 16 #include "base/message_loop/message_loop.h"
14 #include "base/run_loop.h" 17 #include "base/run_loop.h"
15 #include "base/single_thread_task_runner.h" 18 #include "base/single_thread_task_runner.h"
16 #include "base/strings/utf_string_conversions.h" 19 #include "base/strings/utf_string_conversions.h"
17 #include "base/task_scheduler/task_scheduler.h" 20 #include "base/task_scheduler/task_scheduler.h"
18 #include "base/threading/sequenced_worker_pool.h" 21 #include "base/threading/sequenced_worker_pool.h"
19 #include "base/threading/thread_task_runner_handle.h" 22 #include "base/threading/thread_task_runner_handle.h"
20 #include "base/values.h" 23 #include "base/values.h"
21 #include "build/build_config.h" 24 #include "build/build_config.h"
22 #include "components/variations/variations_params_manager.h" 25 #include "components/variations/variations_params_manager.h"
23 #include "content/common/site_isolation_policy.h" 26 #include "content/common/site_isolation_policy.h"
24 #include "content/common/url_schemes.h" 27 #include "content/common/url_schemes.h"
25 #include "content/public/browser/browser_child_process_host_iterator.h" 28 #include "content/public/browser/browser_child_process_host_iterator.h"
26 #include "content/public/browser/notification_service.h" 29 #include "content/public/browser/notification_service.h"
27 #include "content/public/browser/render_frame_host.h" 30 #include "content/public/browser/render_frame_host.h"
28 #include "content/public/browser/render_process_host.h" 31 #include "content/public/browser/render_process_host.h"
29 #include "content/public/browser/web_contents.h" 32 #include "content/public/browser/web_contents.h"
33 #include "content/public/common/content_features.h"
30 #include "content/public/common/content_switches.h" 34 #include "content/public/common/content_switches.h"
31 #include "content/public/common/process_type.h" 35 #include "content/public/common/process_type.h"
32 #include "content/public/test/test_launcher.h" 36 #include "content/public/test/test_launcher.h"
33 #include "content/public/test/test_service_manager_context.h" 37 #include "content/public/test/test_service_manager_context.h"
34 #include "testing/gtest/include/gtest/gtest.h" 38 #include "testing/gtest/include/gtest/gtest.h"
35 #include "url/url_util.h" 39 #include "url/url_util.h"
36 40
37 #if defined(OS_ANDROID) 41 #if defined(OS_ANDROID)
38 #include "content/browser/android/browser_jni_registrar.h" 42 #include "content/browser/android/browser_jni_registrar.h"
39 #include "mojo/android/system/mojo_jni_registrar.h" 43 #include "mojo/android/system/mojo_jni_registrar.h"
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 // Enable all the |feature|, associating them with |trial_name|. 227 // Enable all the |feature|, associating them with |trial_name|.
224 command_line->AppendSwitchASCII( 228 command_line->AppendSwitchASCII(
225 switches::kEnableFeatures, 229 switches::kEnableFeatures,
226 std::string(feature.name) + "<" + kFakeTrialName); 230 std::string(feature.name) + "<" + kFakeTrialName);
227 231
228 std::map<std::string, std::string> param_values = {{param_name, param_value}}; 232 std::map<std::string, std::string> param_values = {{param_name, param_value}};
229 variations::testing::VariationParamsManager::AppendVariationParams( 233 variations::testing::VariationParamsManager::AppendVariationParams(
230 kFakeTrialName, kFakeTrialGroupName, param_values, command_line); 234 kFakeTrialName, kFakeTrialGroupName, param_values, command_line);
231 } 235 }
232 236
237 void EnableTopDocumentIsolationForTesting(base::CommandLine* command_line) {
238 EnableFeatureWithParam(
239 features::kTopDocumentIsolation, features::kTopDocumentIsolationModeParam,
240 std::to_string(
241 static_cast<int>(features::TopDocumentIsolationMode::CrossSite)),
242 command_line);
Łukasz Anforowicz 2017/07/17 17:34:37 This is now rebased on top of r486814.
243 }
244
233 #if defined(OS_ANDROID) 245 #if defined(OS_ANDROID)
234 // Registers content/browser and mojo JNI bindings necessary for some types of 246 // Registers content/browser and mojo JNI bindings necessary for some types of
235 // tests. 247 // tests.
236 bool RegisterJniForTesting(JNIEnv* env) { 248 bool RegisterJniForTesting(JNIEnv* env) {
237 return mojo::android::RegisterSystemJni(env) && 249 return mojo::android::RegisterSystemJni(env) &&
238 content::android::RegisterBrowserJni(env); 250 content::android::RegisterBrowserJni(env);
239 } 251 }
240 #endif 252 #endif
241 253
242 MessageLoopRunner::MessageLoopRunner(QuitMode quit_mode) 254 MessageLoopRunner::MessageLoopRunner(QuitMode quit_mode)
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 431
420 void WebContentsDestroyedWatcher::Wait() { 432 void WebContentsDestroyedWatcher::Wait() {
421 run_loop_.Run(); 433 run_loop_.Run();
422 } 434 }
423 435
424 void WebContentsDestroyedWatcher::WebContentsDestroyed() { 436 void WebContentsDestroyedWatcher::WebContentsDestroyed() {
425 run_loop_.Quit(); 437 run_loop_.Quit();
426 } 438 }
427 439
428 } // namespace content 440 } // namespace content
OLDNEW
« no previous file with comments | « content/public/test/test_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698