OLD | NEW |
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 "base/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
6 #include "extensions/common/extension.h" | 6 #include "extensions/common/extension.h" |
7 #include "extensions/common/features/feature.h" | 7 #include "extensions/common/features/feature.h" |
8 #include "extensions/renderer/script_context.h" | 8 #include "extensions/renderer/script_context.h" |
9 #include "extensions/renderer/script_context_set.h" | 9 #include "extensions/renderer/script_context_set.h" |
10 #include "gin/public/context_holder.h" | 10 #include "gin/public/context_holder.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 // GetAll() returns a copy so removing from one should not remove from others. | 46 // GetAll() returns a copy so removing from one should not remove from others. |
47 ScriptContextSet::ContextSet set_copy = context_set.GetAll(); | 47 ScriptContextSet::ContextSet set_copy = context_set.GetAll(); |
48 EXPECT_EQ(1u, set_copy.count(context)); | 48 EXPECT_EQ(1u, set_copy.count(context)); |
49 | 49 |
50 context_set.Remove(context); | 50 context_set.Remove(context); |
51 EXPECT_EQ(0, context_set.size()); | 51 EXPECT_EQ(0, context_set.size()); |
52 EXPECT_FALSE(context_set.GetByV8Context(context->v8_context())); | 52 EXPECT_FALSE(context_set.GetByV8Context(context->v8_context())); |
53 EXPECT_EQ(1u, set_copy.size()); | 53 EXPECT_EQ(1u, set_copy.size()); |
54 | 54 |
55 // After removal, the context should be marked for destruction. | 55 // After removal, the context should be marked for destruction. |
56 EXPECT_FALSE(context->web_frame()); | 56 EXPECT_FALSE(context->is_valid()); |
57 | 57 |
58 // Run loop to do the actual deletion. | 58 // Run loop to do the actual deletion. |
59 loop.RunUntilIdle(); | 59 loop.RunUntilIdle(); |
60 } | 60 } |
61 | 61 |
62 } // namespace extensions | 62 } // namespace extensions |
OLD | NEW |