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

Side by Side Diff: webkit/glue/cpp_bound_class_unittest.cc

Issue 10938008: Initialize user agent name to avoid assertion failures. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 | Annotate | Revision Log
« 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 (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 // Tests for CppBoundClass, in conjunction with CppBindingExample. Binds 5 // Tests for CppBoundClass, in conjunction with CppBindingExample. Binds
6 // a CppBindingExample class into JavaScript in a custom test shell and tests 6 // a CppBindingExample class into JavaScript in a custom test shell and tests
7 // the binding from the outside by loading JS into the shell. 7 // the binding from the outside by loading JS into the shell.
8 8
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
13 #include "base/message_loop.h" 13 #include "base/message_loop.h"
14 #include "base/string_util.h" 14 #include "base/string_util.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 #include "third_party/WebKit/Source/Platform/chromium/public/WebURLRequest.h" 16 #include "third_party/WebKit/Source/Platform/chromium/public/WebURLRequest.h"
17 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" 17 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h"
18 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" 18 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h"
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrameClient.h" 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrameClient.h"
21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h"
22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSettings.h" 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSettings.h"
23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebViewClient.h" 24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebViewClient.h"
25 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebData.h" 25 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebData.h"
26 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebKitPlatfo rmSupport.h" 26 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebKitPlatfo rmSupport.h"
27 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" 27 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h"
28 #include "webkit/glue/cpp_binding_example.h" 28 #include "webkit/glue/cpp_binding_example.h"
29 #include "webkit/glue/webkit_glue.h" 29 #include "webkit/glue/webkit_glue.h"
30 #include "webkit/user_agent/user_agent.h"
31 #include "webkit/user_agent/user_agent_util.h"
30 32
31 using WebKit::WebFrame; 33 using WebKit::WebFrame;
32 using WebKit::WebView; 34 using WebKit::WebView;
33 using webkit_glue::CppArgumentList; 35 using webkit_glue::CppArgumentList;
34 using webkit_glue::CppBindingExample; 36 using webkit_glue::CppBindingExample;
35 using webkit_glue::CppVariant; 37 using webkit_glue::CppVariant;
36 38
37 namespace { 39 namespace {
38 40
39 class CppBindingExampleSubObject : public CppBindingExample { 41 class CppBindingExampleSubObject : public CppBindingExample {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 }; 84 };
83 85
84 class TestWebViewClient : public WebKit::WebViewClient { 86 class TestWebViewClient : public WebKit::WebViewClient {
85 }; 87 };
86 88
87 class CppBoundClassTest : public testing::Test, public WebKit::WebFrameClient { 89 class CppBoundClassTest : public testing::Test, public WebKit::WebFrameClient {
88 public: 90 public:
89 CppBoundClassTest() : webview_(NULL) { } 91 CppBoundClassTest() : webview_(NULL) { }
90 92
91 virtual void SetUp() OVERRIDE { 93 virtual void SetUp() OVERRIDE {
94 webkit_glue::SetUserAgent(webkit_glue::BuildUserAgentFromProduct(
95 "TestShell/0.0.0.0"), false);
96
92 webview_ = WebView::create(&webview_client_); 97 webview_ = WebView::create(&webview_client_);
93 webview_->settings()->setJavaScriptEnabled(true); 98 webview_->settings()->setJavaScriptEnabled(true);
94 webview_->initializeMainFrame(&webframe_client_); 99 webview_->initializeMainFrame(&webframe_client_);
95 webframe_client_.set_fallback_method_enabled(useFallback()); 100 webframe_client_.set_fallback_method_enabled(useFallback());
96 101
97 WebKit::WebURLRequest urlRequest; 102 WebKit::WebURLRequest urlRequest;
98 urlRequest.initialize(); 103 urlRequest.initialize();
99 urlRequest.setURL(GURL("about:blank")); 104 urlRequest.setURL(GURL("about:blank"));
100 webframe()->loadRequest(urlRequest); 105 webframe()->loadRequest(urlRequest);
101 } 106 }
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 298
294 // Ensures existent methods can be invoked successfully when the fallback method 299 // Ensures existent methods can be invoked successfully when the fallback method
295 // is used 300 // is used
296 TEST_F(CppBoundClassWithFallbackMethodTest, 301 TEST_F(CppBoundClassWithFallbackMethodTest,
297 InvokeExistentMethodsWithFallback) { 302 InvokeExistentMethodsWithFallback) {
298 std::string js = BuildJSCondition("example.echoValue(34)", "34"); 303 std::string js = BuildJSCondition("example.echoValue(34)", "34");
299 CheckJavaScriptSuccess(js); 304 CheckJavaScriptSuccess(js);
300 } 305 }
301 306
302 } // namespace 307 } // namespace
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