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

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

Issue 2087293003: [DevTools] Network.emulateNetworkConditions now affects NetworkStateNotifier. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ScopedNotifier Created 4 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
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 2359 matching lines...) Expand 10 before | Expand all | Expand 10 after
2370 frame()->document()->clearFocusedElement(); 2370 frame()->document()->clearFocusedElement();
2371 frame()->page()->focusController().setInitialFocus(reverse ? WebFocusTypeBac kward : WebFocusTypeForward); 2371 frame()->page()->focusController().setInitialFocus(reverse ? WebFocusTypeBac kward : WebFocusTypeForward);
2372 } 2372 }
2373 2373
2374 bool Internals::ignoreLayoutWithPendingStylesheets(Document* document) 2374 bool Internals::ignoreLayoutWithPendingStylesheets(Document* document)
2375 { 2375 {
2376 ASSERT(document); 2376 ASSERT(document);
2377 return document->ignoreLayoutWithPendingStylesheets(); 2377 return document->ignoreLayoutWithPendingStylesheets();
2378 } 2378 }
2379 2379
2380 void Internals::setNetworkStateNotifierTestOnly(bool testOnly) 2380 void Internals::setNetworkConnectionInfoOverride(bool onLine, const String& type , double downlinkMaxMbps, ExceptionState& exceptionState)
2381 {
2382 networkStateNotifier().setTestUpdatesOnly(testOnly);
2383 }
2384
2385 void Internals::setNetworkConnectionInfo(const String& type, double downlinkMaxM bps, ExceptionState& exceptionState)
2386 { 2381 {
2387 WebConnectionType webtype; 2382 WebConnectionType webtype;
2388 if (type == "cellular2g") { 2383 if (type == "cellular2g") {
2389 webtype = WebConnectionTypeCellular2G; 2384 webtype = WebConnectionTypeCellular2G;
2390 } else if (type == "cellular3g") { 2385 } else if (type == "cellular3g") {
2391 webtype = WebConnectionTypeCellular3G; 2386 webtype = WebConnectionTypeCellular3G;
2392 } else if (type == "cellular4g") { 2387 } else if (type == "cellular4g") {
2393 webtype = WebConnectionTypeCellular4G; 2388 webtype = WebConnectionTypeCellular4G;
2394 } else if (type == "bluetooth") { 2389 } else if (type == "bluetooth") {
2395 webtype = WebConnectionTypeBluetooth; 2390 webtype = WebConnectionTypeBluetooth;
2396 } else if (type == "ethernet") { 2391 } else if (type == "ethernet") {
2397 webtype = WebConnectionTypeEthernet; 2392 webtype = WebConnectionTypeEthernet;
2398 } else if (type == "wifi") { 2393 } else if (type == "wifi") {
2399 webtype = WebConnectionTypeWifi; 2394 webtype = WebConnectionTypeWifi;
2400 } else if (type == "wimax") { 2395 } else if (type == "wimax") {
2401 webtype = WebConnectionTypeWimax; 2396 webtype = WebConnectionTypeWimax;
2402 } else if (type == "other") { 2397 } else if (type == "other") {
2403 webtype = WebConnectionTypeOther; 2398 webtype = WebConnectionTypeOther;
2404 } else if (type == "none") { 2399 } else if (type == "none") {
2405 webtype = WebConnectionTypeNone; 2400 webtype = WebConnectionTypeNone;
2406 } else if (type == "unknown") { 2401 } else if (type == "unknown") {
2407 webtype = WebConnectionTypeUnknown; 2402 webtype = WebConnectionTypeUnknown;
2408 } else { 2403 } else {
2409 exceptionState.throwDOMException(NotFoundError, ExceptionMessages::faile dToEnumerate("connection type", type)); 2404 exceptionState.throwDOMException(NotFoundError, ExceptionMessages::faile dToEnumerate("connection type", type));
2410 return; 2405 return;
2411 } 2406 }
2412 networkStateNotifier().setWebConnectionForTest(webtype, downlinkMaxMbps); 2407 networkStateNotifier().setOverride(onLine, webtype, downlinkMaxMbps);
2408 }
2409
2410 void Internals::clearNetworkConnectionInfoOverride()
2411 {
2412 networkStateNotifier().clearOverride();
2413 } 2413 }
2414 2414
2415 unsigned Internals::countHitRegions(CanvasRenderingContext* context) 2415 unsigned Internals::countHitRegions(CanvasRenderingContext* context)
2416 { 2416 {
2417 return context->hitRegionsCount(); 2417 return context->hitRegionsCount();
2418 } 2418 }
2419 2419
2420 bool Internals::isInCanvasFontCache(Document* document, const String& fontString ) 2420 bool Internals::isInCanvasFontCache(Document* document, const String& fontString )
2421 { 2421 {
2422 return document->canvasFontCache()->isInCache(fontString); 2422 return document->canvasFontCache()->isInCache(fontString);
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
2565 } 2565 }
2566 2566
2567 String Internals::getProgrammaticScrollAnimationState(Node* node) const 2567 String Internals::getProgrammaticScrollAnimationState(Node* node) const
2568 { 2568 {
2569 if (ScrollableArea* scrollableArea = scrollableAreaForNode(node)) 2569 if (ScrollableArea* scrollableArea = scrollableAreaForNode(node))
2570 return scrollableArea->programmaticScrollAnimator().runStateAsText(); 2570 return scrollableArea->programmaticScrollAnimator().runStateAsText();
2571 return String(); 2571 return String();
2572 } 2572 }
2573 2573
2574 } // namespace blink 2574 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698