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

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

Issue 2714813003: Add an identity component for unique/opaque url::Origins.
Patch Set: Switch to base::UnguessableToken, add to SecurityOrigin. No conversions yet. Created 3 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/weborigin/DEPS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/dom/ElementVisibilityObserver.h" 5 #include "core/dom/ElementVisibilityObserver.h"
6 6
7 #include "core/dom/DOMImplementation.h" 7 #include "core/dom/DOMImplementation.h"
8 #include "core/dom/Document.h" 8 #include "core/dom/Document.h"
9 #include "core/frame/RemoteFrame.h" 9 #include "core/frame/RemoteFrame.h"
10 #include "core/html/HTMLDivElement.h" 10 #include "core/html/HTMLDivElement.h"
11 #include "core/html/HTMLDocument.h" 11 #include "core/html/HTMLDocument.h"
12 #include "core/loader/EmptyClients.h" 12 #include "core/loader/EmptyClients.h"
13 #include "core/testing/DummyPageHolder.h" 13 #include "core/testing/DummyPageHolder.h"
14 #include "platform/weborigin/SecurityOrigin.h"
14 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
15 16
16 namespace blink { 17 namespace blink {
17 18
18 namespace { 19 namespace {
19 20
20 // Stub implementation of FrameLoaderClient for the purpose of testing. It will 21 // Stub implementation of FrameLoaderClient for the purpose of testing. It will
21 // alow callers to set the parent/top frames by calling |setParent|. It is used 22 // alow callers to set the parent/top frames by calling |setParent|. It is used
22 // in ElementVisibilityObserverTest in order to mock a RemoteFrame parent of a 23 // in ElementVisibilityObserverTest in order to mock a RemoteFrame parent of a
23 // LocalFrame. 24 // LocalFrame.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 ElementVisibilityObserver* observer = 67 ElementVisibilityObserver* observer =
67 new ElementVisibilityObserver(element, nullptr); 68 new ElementVisibilityObserver(element, nullptr);
68 observer->start(); 69 observer->start();
69 observer->stop(); 70 observer->stop();
70 // It should not crash. 71 // It should not crash.
71 } 72 }
72 73
73 TEST_F(ElementVisibilityObserverTest, ObserveElementInRemoteFrame) { 74 TEST_F(ElementVisibilityObserverTest, ObserveElementInRemoteFrame) {
74 Persistent<RemoteFrame> remoteFrame = 75 Persistent<RemoteFrame> remoteFrame =
75 RemoteFrame::create(new EmptyRemoteFrameClient(), &frameHost(), nullptr); 76 RemoteFrame::create(new EmptyRemoteFrameClient(), &frameHost(), nullptr);
77 remoteFrame->securityContext()->setReplicatedOrigin(
78 SecurityOrigin::createUnique());
76 frameLoaderClient()->setParent(remoteFrame); 79 frameLoaderClient()->setParent(remoteFrame);
77 80
78 Persistent<HTMLElement> element = HTMLDivElement::create(document()); 81 Persistent<HTMLElement> element = HTMLDivElement::create(document());
79 ElementVisibilityObserver* observer = 82 ElementVisibilityObserver* observer =
80 new ElementVisibilityObserver(element, WTF::bind([](bool) {})); 83 new ElementVisibilityObserver(element, WTF::bind([](bool) {}));
81 observer->start(); 84 observer->start();
82 observer->deliverObservationsForTesting(); 85 observer->deliverObservationsForTesting();
83 observer->stop(); 86 observer->stop();
84 // It should not crash. 87 // It should not crash.
85 } 88 }
86 89
87 } // anonymous namespace 90 } // anonymous namespace
88 91
89 } // blink namespace 92 } // blink namespace
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/weborigin/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698