Chromium Code Reviews

Side by Side Diff: third_party/WebKit/Source/core/page/NetworkStateNotifierTest.cpp

Issue 1549143002: Add thread affinity and ASSERT() for same-thread restriction to WTF::Function (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@TRV_ThreadSafeBindByVariadicTemplate
Patch Set: Rebase. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
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 62 matching lines...)
73 double observedMaxBandwidth() const 73 double observedMaxBandwidth() const
74 { 74 {
75 return m_observedMaxBandwidthMbps; 75 return m_observedMaxBandwidthMbps;
76 } 76 }
77 77
78 int callbackCount() const 78 int callbackCount() const
79 { 79 {
80 return m_callbackCount; 80 return m_callbackCount;
81 } 81 }
82 82
83 void setNotificationCallback(PassOwnPtr<Closure> closure) 83 void setNotificationCallback(PassOwnPtr<SameThreadClosure> closure)
84 { 84 {
85 m_closure = closure; 85 m_closure = closure;
86 } 86 }
87 87
88 private: 88 private:
89 OwnPtr<Closure> m_closure; 89 OwnPtr<SameThreadClosure> m_closure;
90 WebConnectionType m_observedType; 90 WebConnectionType m_observedType;
91 double m_observedMaxBandwidthMbps; 91 double m_observedMaxBandwidthMbps;
92 int m_callbackCount; 92 int m_callbackCount;
93 }; 93 };
94 94
95 class NetworkStateNotifierTest : public ::testing::Test { 95 class NetworkStateNotifierTest : public ::testing::Test {
96 public: 96 public:
97 NetworkStateNotifierTest() 97 NetworkStateNotifierTest()
98 : m_document(Document::create()) 98 : m_document(Document::create())
99 , m_document2(Document::create()) 99 , m_document2(Document::create())
(...skipping 172 matching lines...)
272 m_notifier.addObserver(&observer2, executionContext2()); 272 m_notifier.addObserver(&observer2, executionContext2());
273 m_notifier.removeObserver(&observer1, executionContext()); 273 m_notifier.removeObserver(&observer1, executionContext());
274 m_notifier.removeObserver(&observer2, executionContext2()); 274 m_notifier.removeObserver(&observer2, executionContext2());
275 275
276 setConnection(WebConnectionTypeBluetooth, kBluetoothMaxBandwidthMbps); 276 setConnection(WebConnectionTypeBluetooth, kBluetoothMaxBandwidthMbps);
277 EXPECT_TRUE(verifyObservations(observer1, WebConnectionTypeNone, kNoneMaxBan dwidthMbps)); 277 EXPECT_TRUE(verifyObservations(observer1, WebConnectionTypeNone, kNoneMaxBan dwidthMbps));
278 EXPECT_TRUE(verifyObservations(observer2, WebConnectionTypeNone, kNoneMaxBan dwidthMbps)); 278 EXPECT_TRUE(verifyObservations(observer2, WebConnectionTypeNone, kNoneMaxBan dwidthMbps));
279 } 279 }
280 280
281 } // namespace blink 281 } // namespace blink
OLDNEW

Powered by Google App Engine