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

Side by Side Diff: extensions/renderer/script_context_set_unittest.cc

Issue 1210513002: ScriptContextSetTest should close the main frame before finishing the test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <vector> 5 #include <vector>
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "extensions/common/extension.h" 8 #include "extensions/common/extension.h"
9 #include "extensions/common/extension_set.h" 9 #include "extensions/common/extension_set.h"
10 #include "extensions/common/features/feature.h" 10 #include "extensions/common/features/feature.h"
11 #include "extensions/renderer/script_context.h" 11 #include "extensions/renderer/script_context.h"
12 #include "extensions/renderer/script_context_set.h" 12 #include "extensions/renderer/script_context_set.h"
13 #include "gin/public/context_holder.h" 13 #include "gin/public/context_holder.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 #include "third_party/WebKit/public/web/WebHeap.h"
15 #include "third_party/WebKit/public/web/WebLocalFrame.h" 16 #include "third_party/WebKit/public/web/WebLocalFrame.h"
16 #include "third_party/WebKit/public/web/WebView.h" 17 #include "third_party/WebKit/public/web/WebView.h"
17 #include "v8/include/v8.h" 18 #include "v8/include/v8.h"
18 19
19 namespace extensions { 20 namespace extensions {
20 21
21 TEST(ScriptContextSetTest, Lifecycle) { 22 TEST(ScriptContextSetTest, Lifecycle) {
22 base::MessageLoop loop; 23 base::MessageLoop loop;
23 24
24 blink::WebView* webview = blink::WebView::create(nullptr); 25 blink::WebView* webview = blink::WebView::create(nullptr);
(...skipping 28 matching lines...) Expand all
53 EXPECT_EQ(context, context_set.GetByV8Context(v8_context)); 54 EXPECT_EQ(context, context_set.GetByV8Context(v8_context));
54 55
55 // Test context is correctly removed. 56 // Test context is correctly removed.
56 context_set.Remove(context); 57 context_set.Remove(context);
57 EXPECT_EQ(0u, context_set.size()); 58 EXPECT_EQ(0u, context_set.size());
58 EXPECT_EQ(nullptr, context_set.GetByV8Context(v8_context)); 59 EXPECT_EQ(nullptr, context_set.GetByV8Context(v8_context));
59 60
60 // After removal, the context should be marked for destruction. 61 // After removal, the context should be marked for destruction.
61 EXPECT_FALSE(context->is_valid()); 62 EXPECT_FALSE(context->is_valid());
62 63
64 webview->close();
65 frame->close();
66
67 blink::WebHeap::collectAllGarbageForTesting();
not at google - send to devlin 2015/06/24 16:08:47 This will probably regress at some point in the fu
68
63 // Run loop to do the actual deletion. 69 // Run loop to do the actual deletion.
64 loop.RunUntilIdle(); 70 loop.RunUntilIdle();
65 } 71 }
66 72
67 } // namespace extensions 73 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698