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

Side by Side Diff: Source/core/testing/Internals.cpp

Issue 1308943005: [NetInfo] Add Blink support for connection.change, connection.downlinkMax, and wimax (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add units Created 5 years, 3 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2013 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 2347 matching lines...) Expand 10 before | Expand all | Expand 10 after
2358 { 2358 {
2359 ASSERT(document); 2359 ASSERT(document);
2360 return document->ignoreLayoutWithPendingStylesheets(); 2360 return document->ignoreLayoutWithPendingStylesheets();
2361 } 2361 }
2362 2362
2363 void Internals::setNetworkStateNotifierTestOnly(bool testOnly) 2363 void Internals::setNetworkStateNotifierTestOnly(bool testOnly)
2364 { 2364 {
2365 networkStateNotifier().setTestUpdatesOnly(testOnly); 2365 networkStateNotifier().setTestUpdatesOnly(testOnly);
2366 } 2366 }
2367 2367
2368 void Internals::setNetworkConnectionInfo(const String& type, ExceptionState& exc eptionState) 2368 void Internals::setNetworkConnectionInfo(const String& type, double downlinkMaxM bps, ExceptionState& exceptionState)
2369 { 2369 {
2370 WebConnectionType webtype; 2370 WebConnectionType webtype;
2371 if (type == "cellular") { 2371 if (type == "cellular") {
2372 webtype = ConnectionTypeCellular; 2372 webtype = ConnectionTypeCellular;
2373 } else if (type == "bluetooth") { 2373 } else if (type == "bluetooth") {
2374 webtype = ConnectionTypeBluetooth; 2374 webtype = ConnectionTypeBluetooth;
2375 } else if (type == "ethernet") { 2375 } else if (type == "ethernet") {
2376 webtype = ConnectionTypeEthernet; 2376 webtype = ConnectionTypeEthernet;
2377 } else if (type == "wifi") { 2377 } else if (type == "wifi") {
2378 webtype = ConnectionTypeWifi; 2378 webtype = ConnectionTypeWifi;
2379 } else if (type == "wimax") {
2380 webtype = ConnectionTypeWimax;
2379 } else if (type == "other") { 2381 } else if (type == "other") {
2380 webtype = ConnectionTypeOther; 2382 webtype = ConnectionTypeOther;
2381 } else if (type == "none") { 2383 } else if (type == "none") {
2382 webtype = ConnectionTypeNone; 2384 webtype = ConnectionTypeNone;
2383 } else if (type == "unknown") { 2385 } else if (type == "unknown") {
2384 webtype = ConnectionTypeUnknown; 2386 webtype = ConnectionTypeUnknown;
2385 } else { 2387 } else {
2386 exceptionState.throwDOMException(NotFoundError, ExceptionMessages::faile dToEnumerate("connection type", type)); 2388 exceptionState.throwDOMException(NotFoundError, ExceptionMessages::faile dToEnumerate("connection type", type));
2387 return; 2389 return;
2388 } 2390 }
2389 networkStateNotifier().setWebConnectionTypeForTest(webtype); 2391 networkStateNotifier().setWebConnectionForTest(webtype, downlinkMaxMbps);
2390 } 2392 }
2391 2393
2392 unsigned Internals::countHitRegions(CanvasRenderingContext* context) 2394 unsigned Internals::countHitRegions(CanvasRenderingContext* context)
2393 { 2395 {
2394 return context->hitRegionsCount(); 2396 return context->hitRegionsCount();
2395 } 2397 }
2396 2398
2397 bool Internals::isInCanvasFontCache(Document* document, const String& fontString ) 2399 bool Internals::isInCanvasFontCache(Document* document, const String& fontString )
2398 { 2400 {
2399 return document->canvasFontCache()->isInCache(fontString); 2401 return document->canvasFontCache()->isInCache(fontString);
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
2492 2494
2493 return animator->setScrollbarsVisibleForTesting(visible); 2495 return animator->setScrollbarsVisibleForTesting(visible);
2494 } 2496 }
2495 2497
2496 void Internals::forceRestrictIFramePermissions() 2498 void Internals::forceRestrictIFramePermissions()
2497 { 2499 {
2498 RuntimeEnabledFeatures::setRestrictIFramePermissionsEnabled(true); 2500 RuntimeEnabledFeatures::setRestrictIFramePermissionsEnabled(true);
2499 } 2501 }
2500 2502
2501 } // namespace blink 2503 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698