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

Side by Side Diff: third_party/WebKit/Source/platform/testing/TestingPlatformSupport.cpp

Issue 1780083002: Introduce Platform::setCurrentPlatformForTesting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 75
76 TestingPlatformSupport::TestingPlatformSupport() 76 TestingPlatformSupport::TestingPlatformSupport()
77 : TestingPlatformSupport(TestingPlatformSupport::Config()) 77 : TestingPlatformSupport(TestingPlatformSupport::Config())
78 { 78 {
79 } 79 }
80 80
81 TestingPlatformSupport::TestingPlatformSupport(const Config& config) 81 TestingPlatformSupport::TestingPlatformSupport(const Config& config)
82 : m_config(config) 82 : m_config(config)
83 , m_oldPlatform(Platform::current()) 83 , m_oldPlatform(Platform::current())
84 { 84 {
85 Platform::initialize(this); 85 Platform::setCurrentPlatformForTesting(this);
86 } 86 }
87 87
88 TestingPlatformSupport::~TestingPlatformSupport() 88 TestingPlatformSupport::~TestingPlatformSupport()
89 { 89 {
90 Platform::initialize(m_oldPlatform); 90 Platform::setCurrentPlatformForTesting(m_oldPlatform);
91 } 91 }
92 92
93 WebDiscardableMemory* TestingPlatformSupport::allocateAndLockDiscardableMemory(s ize_t bytes) 93 WebDiscardableMemory* TestingPlatformSupport::allocateAndLockDiscardableMemory(s ize_t bytes)
94 { 94 {
95 return !m_config.hasDiscardableMemorySupport ? 0 : new TestingDiscardableMem ory(bytes); 95 return !m_config.hasDiscardableMemorySupport ? 0 : new TestingDiscardableMem ory(bytes);
96 } 96 }
97 97
98 WebString TestingPlatformSupport::defaultLocale() 98 WebString TestingPlatformSupport::defaultLocale()
99 { 99 {
100 return WebString::fromUTF8("en-US"); 100 return WebString::fromUTF8("en-US");
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 { 241 {
242 return m_mockWebThread.get(); 242 return m_mockWebThread.get();
243 } 243 }
244 244
245 TestingPlatformMockScheduler* TestingPlatformSupportWithMockScheduler::mockWebSc heduler() 245 TestingPlatformMockScheduler* TestingPlatformSupportWithMockScheduler::mockWebSc heduler()
246 { 246 {
247 return m_mockWebThread->mockWebScheduler(); 247 return m_mockWebThread->mockWebScheduler();
248 } 248 }
249 249
250 } // namespace blink 250 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/testing/RunAllTests.cpp ('k') | third_party/WebKit/public/platform/Platform.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698