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

Side by Side Diff: third_party/WebKit/Source/core/dom/SuspendableObjectTest.cpp

Issue 2629593004: Disambiguate LifecycleObserver::contextDestroyed (Closed)
Patch Set: temp Created 3 years, 11 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 USING_GARBAGE_COLLECTED_MIXIN(MockSuspendableObject); 44 USING_GARBAGE_COLLECTED_MIXIN(MockSuspendableObject);
45 45
46 public: 46 public:
47 explicit MockSuspendableObject(ExecutionContext* context) 47 explicit MockSuspendableObject(ExecutionContext* context)
48 : SuspendableObject(context) {} 48 : SuspendableObject(context) {}
49 49
50 DEFINE_INLINE_VIRTUAL_TRACE() { SuspendableObject::trace(visitor); } 50 DEFINE_INLINE_VIRTUAL_TRACE() { SuspendableObject::trace(visitor); }
51 51
52 MOCK_METHOD0(suspend, void()); 52 MOCK_METHOD0(suspend, void());
53 MOCK_METHOD0(resume, void()); 53 MOCK_METHOD0(resume, void());
54 MOCK_METHOD0(contextDestroyed, void()); 54 MOCK_METHOD1(contextDestroyed, void(ExecutionContext*));
55 }; 55 };
56 56
57 class SuspendableObjectTest : public ::testing::Test { 57 class SuspendableObjectTest : public ::testing::Test {
58 protected: 58 protected:
59 SuspendableObjectTest(); 59 SuspendableObjectTest();
60 60
61 Document& srcDocument() const { return m_srcPageHolder->document(); } 61 Document& srcDocument() const { return m_srcPageHolder->document(); }
62 Document& destDocument() const { return m_destPageHolder->document(); } 62 Document& destDocument() const { return m_destPageHolder->document(); }
63 MockSuspendableObject& suspendableObject() { return *m_suspendableObject; } 63 MockSuspendableObject& suspendableObject() { return *m_suspendableObject; }
64 64
(...skipping 30 matching lines...) Expand all
95 TEST_F(SuspendableObjectTest, MoveToSuspendedDocument) { 95 TEST_F(SuspendableObjectTest, MoveToSuspendedDocument) {
96 destDocument().suspendScheduledTasks(); 96 destDocument().suspendScheduledTasks();
97 97
98 EXPECT_CALL(suspendableObject(), suspend()); 98 EXPECT_CALL(suspendableObject(), suspend());
99 suspendableObject().didMoveToNewExecutionContext(&destDocument()); 99 suspendableObject().didMoveToNewExecutionContext(&destDocument());
100 } 100 }
101 101
102 TEST_F(SuspendableObjectTest, MoveToStoppedDocument) { 102 TEST_F(SuspendableObjectTest, MoveToStoppedDocument) {
103 destDocument().shutdown(); 103 destDocument().shutdown();
104 104
105 EXPECT_CALL(suspendableObject(), contextDestroyed()); 105 EXPECT_CALL(suspendableObject(), contextDestroyed(&destDocument()));
106 suspendableObject().didMoveToNewExecutionContext(&destDocument()); 106 suspendableObject().didMoveToNewExecutionContext(&destDocument());
107 } 107 }
108 108
109 } // namespace blink 109 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698