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

Side by Side Diff: third_party/WebKit/Source/web/tests/ActivityLoggerTest.cpp

Issue 2628053003: Remove extension group from DOMWrapperWorld. (Closed)
Patch Set: Fix GCCallbackTest 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "bindings/core/v8/ScriptController.h" 5 #include "bindings/core/v8/ScriptController.h"
6 #include "bindings/core/v8/ScriptSourceCode.h" 6 #include "bindings/core/v8/ScriptSourceCode.h"
7 #include "bindings/core/v8/V8Binding.h" 7 #include "bindings/core/v8/V8Binding.h"
8 #include "bindings/core/v8/V8DOMActivityLogger.h" 8 #include "bindings/core/v8/V8DOMActivityLogger.h"
9 #include "public/web/WebCache.h" 9 #include "public/web/WebCache.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 m_scriptController->executeScriptInMainWorld(script); 89 m_scriptController->executeScriptInMainWorld(script);
90 pumpPendingRequestsForFrameToLoad(m_webViewHelper.webView()->mainFrame()); 90 pumpPendingRequestsForFrameToLoad(m_webViewHelper.webView()->mainFrame());
91 } 91 }
92 92
93 void executeScriptInIsolatedWorld(const String& script) const { 93 void executeScriptInIsolatedWorld(const String& script) const {
94 v8::HandleScope scope(v8::Isolate::GetCurrent()); 94 v8::HandleScope scope(v8::Isolate::GetCurrent());
95 HeapVector<ScriptSourceCode> sources; 95 HeapVector<ScriptSourceCode> sources;
96 sources.push_back(ScriptSourceCode(script)); 96 sources.push_back(ScriptSourceCode(script));
97 Vector<v8::Local<v8::Value>> results; 97 Vector<v8::Local<v8::Value>> results;
98 m_scriptController->executeScriptInIsolatedWorld(isolatedWorldId, sources, 98 m_scriptController->executeScriptInIsolatedWorld(isolatedWorldId, sources,
99 extensionGroup, 0); 99 0);
100 pumpPendingRequestsForFrameToLoad(m_webViewHelper.webView()->mainFrame()); 100 pumpPendingRequestsForFrameToLoad(m_webViewHelper.webView()->mainFrame());
101 } 101 }
102 102
103 bool verifyActivities(const String& activities) { 103 bool verifyActivities(const String& activities) {
104 Vector<String> activityVector; 104 Vector<String> activityVector;
105 activities.split("\n", activityVector); 105 activities.split("\n", activityVector);
106 return m_activityLogger->verifyActivities(activityVector); 106 return m_activityLogger->verifyActivities(activityVector);
107 } 107 }
108 108
109 private: 109 private:
110 static const int isolatedWorldId = 1; 110 static const int isolatedWorldId = 1;
111 static const int extensionGroup = 0;
112 111
113 WebViewHelper m_webViewHelper; 112 WebViewHelper m_webViewHelper;
114 Persistent<ScriptController> m_scriptController; 113 Persistent<ScriptController> m_scriptController;
115 // TestActivityLogger is owned by a static table within V8DOMActivityLogger 114 // TestActivityLogger is owned by a static table within V8DOMActivityLogger
116 // and should be alive as long as not overwritten. 115 // and should be alive as long as not overwritten.
117 TestActivityLogger* m_activityLogger; 116 TestActivityLogger* m_activityLogger;
118 }; 117 };
119 118
120 TEST_F(ActivityLoggerTest, EventHandler) { 119 TEST_F(ActivityLoggerTest, EventHandler) {
121 const char* code = 120 const char* code =
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 "blinkRequestResource | Script | data:text/html;charset=utf-8,D\n" 585 "blinkRequestResource | Script | data:text/html;charset=utf-8,D\n"
587 "blinkRequestResource | XMLHttpRequest | data:text/html;charset=utf-8,E\n" 586 "blinkRequestResource | XMLHttpRequest | data:text/html;charset=utf-8,E\n"
588 "blinkRequestResource | Image | data:text/html;charset=utf-8,B\n"; 587 "blinkRequestResource | Image | data:text/html;charset=utf-8,B\n";
589 executeScriptInMainWorld(code); 588 executeScriptInMainWorld(code);
590 ASSERT_TRUE(verifyActivities("")); 589 ASSERT_TRUE(verifyActivities(""));
591 executeScriptInIsolatedWorld(code); 590 executeScriptInIsolatedWorld(code);
592 ASSERT_TRUE(verifyActivities(expectedActivities)); 591 ASSERT_TRUE(verifyActivities(expectedActivities));
593 } 592 }
594 593
595 } // namespace blink 594 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebRemoteFrameImpl.cpp ('k') | third_party/WebKit/Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698