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

Side by Side Diff: chrome/renderer/extensions/chrome_v8_context_set_unittest.cc

Issue 63273002: Rename WebKit namespace to blink (part 4) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/common/extensions/extension.h" 6 #include "chrome/common/extensions/extension.h"
7 #include "chrome/renderer/extensions/chrome_v8_context.h" 7 #include "chrome/renderer/extensions/chrome_v8_context.h"
8 #include "chrome/renderer/extensions/chrome_v8_context_set.h" 8 #include "chrome/renderer/extensions/chrome_v8_context_set.h"
9 #include "extensions/common/features/feature.h" 9 #include "extensions/common/features/feature.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "third_party/WebKit/public/web/WebFrame.h" 11 #include "third_party/WebKit/public/web/WebFrame.h"
12 #include "v8/include/v8.h" 12 #include "v8/include/v8.h"
13 13
14 namespace extensions { 14 namespace extensions {
15 15
16 TEST(ChromeV8ContextSet, Lifecycle) { 16 TEST(ChromeV8ContextSet, Lifecycle) {
17 base::MessageLoop loop; 17 base::MessageLoop loop;
18 18
19 ChromeV8ContextSet context_set; 19 ChromeV8ContextSet context_set;
20 20
21 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 21 v8::Isolate* isolate = v8::Isolate::GetCurrent();
22 v8::HandleScope handle_scope(isolate); 22 v8::HandleScope handle_scope(isolate);
23 v8::Handle<v8::Context> v8_context(v8::Context::New(isolate)); 23 v8::Handle<v8::Context> v8_context(v8::Context::New(isolate));
24 24
25 // Dirty hack, but we don't actually need the frame, and this is easier than 25 // Dirty hack, but we don't actually need the frame, and this is easier than
26 // creating a whole webview. 26 // creating a whole webview.
27 WebKit::WebFrame* frame = reinterpret_cast<WebKit::WebFrame*>(1); 27 blink::WebFrame* frame = reinterpret_cast<blink::WebFrame*>(1);
28 const Extension* extension = NULL; 28 const Extension* extension = NULL;
29 ChromeV8Context* context = new ChromeV8Context( 29 ChromeV8Context* context = new ChromeV8Context(
30 v8_context, 30 v8_context,
31 frame, 31 frame,
32 extension, 32 extension,
33 Feature::BLESSED_EXTENSION_CONTEXT); 33 Feature::BLESSED_EXTENSION_CONTEXT);
34 34
35 context_set.Add(context); 35 context_set.Add(context);
36 EXPECT_EQ(1u, context_set.GetAll().count(context)); 36 EXPECT_EQ(1u, context_set.GetAll().count(context));
37 EXPECT_EQ(context, context_set.GetByV8Context(context->v8_context())); 37 EXPECT_EQ(context, context_set.GetByV8Context(context->v8_context()));
(...skipping 12 matching lines...) Expand all
50 EXPECT_EQ(1u, set_copy.size()); 50 EXPECT_EQ(1u, set_copy.size());
51 51
52 // After removal, the context should be marked for destruction. 52 // After removal, the context should be marked for destruction.
53 EXPECT_FALSE(context->web_frame()); 53 EXPECT_FALSE(context->web_frame());
54 54
55 // Run loop to do the actual deletion. 55 // Run loop to do the actual deletion.
56 loop.RunUntilIdle(); 56 loop.RunUntilIdle();
57 } 57 }
58 58
59 } // namespace extensions 59 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/chrome_v8_context.cc ('k') | chrome/renderer/extensions/chrome_v8_extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698