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

Side by Side Diff: third_party/WebKit/Source/web/tests/WebFrameTest.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 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 4259 matching lines...) Expand 10 before | Expand all | Expand 10 after
4270 createNotifications.clear(); 4270 createNotifications.clear();
4271 releaseNotifications.clear(); 4271 releaseNotifications.clear();
4272 } 4272 }
4273 4273
4274 Vector<std::unique_ptr<Notification>> createNotifications; 4274 Vector<std::unique_ptr<Notification>> createNotifications;
4275 Vector<std::unique_ptr<Notification>> releaseNotifications; 4275 Vector<std::unique_ptr<Notification>> releaseNotifications;
4276 4276
4277 private: 4277 private:
4278 void didCreateScriptContext(WebLocalFrame* frame, 4278 void didCreateScriptContext(WebLocalFrame* frame,
4279 v8::Local<v8::Context> context, 4279 v8::Local<v8::Context> context,
4280 int extensionGroup,
4281 int worldId) override { 4280 int worldId) override {
4282 createNotifications.push_back( 4281 createNotifications.push_back(
4283 WTF::makeUnique<Notification>(frame, context, worldId)); 4282 WTF::makeUnique<Notification>(frame, context, worldId));
4284 } 4283 }
4285 4284
4286 void willReleaseScriptContext(WebLocalFrame* frame, 4285 void willReleaseScriptContext(WebLocalFrame* frame,
4287 v8::Local<v8::Context> context, 4286 v8::Local<v8::Context> context,
4288 int worldId) override { 4287 int worldId) override {
4289 releaseNotifications.push_back( 4288 releaseNotifications.push_back(
4290 WTF::makeUnique<Notification>(frame, context, worldId)); 4289 WTF::makeUnique<Notification>(frame, context, worldId));
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
4391 FrameTestHelpers::WebViewHelper webViewHelper; 4390 FrameTestHelpers::WebViewHelper webViewHelper;
4392 webViewHelper.initializeAndLoad(m_baseURL + "context_notifications_test.html", 4391 webViewHelper.initializeAndLoad(m_baseURL + "context_notifications_test.html",
4393 true, &webFrameClient); 4392 true, &webFrameClient);
4394 4393
4395 // Add an isolated world. 4394 // Add an isolated world.
4396 webFrameClient.reset(); 4395 webFrameClient.reset();
4397 4396
4398 int isolatedWorldId = 42; 4397 int isolatedWorldId = 42;
4399 WebScriptSource scriptSource("hi!"); 4398 WebScriptSource scriptSource("hi!");
4400 int numSources = 1; 4399 int numSources = 1;
4401 int extensionGroup = 0;
4402 webViewHelper.webView()->mainFrame()->executeScriptInIsolatedWorld( 4400 webViewHelper.webView()->mainFrame()->executeScriptInIsolatedWorld(
4403 isolatedWorldId, &scriptSource, numSources, extensionGroup); 4401 isolatedWorldId, &scriptSource, numSources);
4404 4402
4405 // We should now have a new create notification. 4403 // We should now have a new create notification.
4406 ASSERT_EQ(1u, webFrameClient.createNotifications.size()); 4404 ASSERT_EQ(1u, webFrameClient.createNotifications.size());
4407 auto& notification = webFrameClient.createNotifications[0]; 4405 auto& notification = webFrameClient.createNotifications[0];
4408 ASSERT_EQ(isolatedWorldId, notification->worldId); 4406 ASSERT_EQ(isolatedWorldId, notification->worldId);
4409 ASSERT_EQ(webViewHelper.webView()->mainFrame(), notification->frame); 4407 ASSERT_EQ(webViewHelper.webView()->mainFrame(), notification->frame);
4410 4408
4411 // We don't have an API to enumarate isolated worlds for a frame, but we can 4409 // We don't have an API to enumarate isolated worlds for a frame, but we can
4412 // at least assert that the context we got is *not* the main world's context. 4410 // at least assert that the context we got is *not* the main world's context.
4413 ASSERT_NE(webViewHelper.webView()->mainFrame()->mainWorldScriptContext(), 4411 ASSERT_NE(webViewHelper.webView()->mainFrame()->mainWorldScriptContext(),
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
4574 EXPECT_FALSE(frame->hasSelection()); 4572 EXPECT_FALSE(frame->hasSelection());
4575 WebString selectionHtml = frame->selectionAsMarkup(); 4573 WebString selectionHtml = frame->selectionAsMarkup();
4576 EXPECT_TRUE(selectionHtml.isEmpty()); 4574 EXPECT_TRUE(selectionHtml.isEmpty());
4577 } 4575 }
4578 4576
4579 class TestExecuteScriptDuringDidCreateScriptContext 4577 class TestExecuteScriptDuringDidCreateScriptContext
4580 : public FrameTestHelpers::TestWebFrameClient { 4578 : public FrameTestHelpers::TestWebFrameClient {
4581 public: 4579 public:
4582 void didCreateScriptContext(WebLocalFrame* frame, 4580 void didCreateScriptContext(WebLocalFrame* frame,
4583 v8::Local<v8::Context> context, 4581 v8::Local<v8::Context> context,
4584 int extensionGroup,
4585 int worldId) override { 4582 int worldId) override {
4586 frame->executeScript(WebScriptSource("window.history = 'replaced';")); 4583 frame->executeScript(WebScriptSource("window.history = 'replaced';"));
4587 } 4584 }
4588 }; 4585 };
4589 4586
4590 TEST_P(ParameterizedWebFrameTest, ExecuteScriptDuringDidCreateScriptContext) { 4587 TEST_P(ParameterizedWebFrameTest, ExecuteScriptDuringDidCreateScriptContext) {
4591 registerMockedHttpURLLoad("hello_world.html"); 4588 registerMockedHttpURLLoad("hello_world.html");
4592 4589
4593 TestExecuteScriptDuringDidCreateScriptContext webFrameClient; 4590 TestExecuteScriptDuringDidCreateScriptContext webFrameClient;
4594 FrameTestHelpers::WebViewHelper webViewHelper; 4591 FrameTestHelpers::WebViewHelper webViewHelper;
(...skipping 6640 matching lines...) Expand 10 before | Expand all | Expand 10 after
11235 11232
11236 EXPECT_TRUE(mainFrameClient.childClient().didCallFrameDetached()); 11233 EXPECT_TRUE(mainFrameClient.childClient().didCallFrameDetached());
11237 EXPECT_TRUE(mainFrameClient.childClient().didCallDidStopLoading()); 11234 EXPECT_TRUE(mainFrameClient.childClient().didCallDidStopLoading());
11238 EXPECT_TRUE(mainFrameClient.childClient().didCallDidFinishDocumentLoad()); 11235 EXPECT_TRUE(mainFrameClient.childClient().didCallDidFinishDocumentLoad());
11239 EXPECT_TRUE(mainFrameClient.childClient().didCallDidHandleOnloadEvents()); 11236 EXPECT_TRUE(mainFrameClient.childClient().didCallDidHandleOnloadEvents());
11240 11237
11241 webViewHelper.reset(); 11238 webViewHelper.reset();
11242 } 11239 }
11243 11240
11244 } // namespace blink 11241 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/tests/ActivityLoggerTest.cpp ('k') | third_party/WebKit/public/web/WebContentSettingsClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698