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

Side by Side Diff: content/browser/renderer_host/render_view_host_browsertest.cc

Issue 10821037: Move a number of other tests from browser_tests to content_browsertests. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: a little cleaner Created 8 years, 5 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
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/time.h" 5 #include "base/time.h"
6 #include "base/utf_string_conversions.h" 6 #include "base/utf_string_conversions.h"
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/browser/ui/browser_tabstrip.h"
10 #include "chrome/test/base/in_process_browser_test.h"
11 #include "chrome/test/base/ui_test_utils.h"
12 #include "content/browser/renderer_host/render_view_host_impl.h" 8 #include "content/browser/renderer_host/render_view_host_impl.h"
13 #include "content/browser/web_contents/web_contents_impl.h" 9 #include "content/browser/web_contents/web_contents_impl.h"
14 #include "content/common/view_messages.h" 10 #include "content/common/view_messages.h"
15 #include "content/public/browser/notification_types.h" 11 #include "content/public/browser/notification_types.h"
16 #include "content/public/browser/web_contents_observer.h" 12 #include "content/public/browser/web_contents_observer.h"
13 #include "content/public/test/browser_test_utils.h"
14 #include "content/public/test/test_browser_thread.h"
15 #include "content/shell/shell.h"
16 #include "content/test/content_browser_test.h"
17 #include "content/test/content_browser_test_utils.h"
17 #include "net/base/host_port_pair.h" 18 #include "net/base/host_port_pair.h"
18 #include "net/base/net_util.h" 19 #include "net/base/net_util.h"
19 #include "net/test/test_server.h" 20 #include "net/test/test_server.h"
20 21
21 using content::RenderViewHostImpl; 22 namespace content {
22 using content::WebContents;
23 23
24 class RenderViewHostTest : public InProcessBrowserTest { 24 class RenderViewHostTest : public ContentBrowserTest {
25 public: 25 public:
26 RenderViewHostTest() {} 26 RenderViewHostTest() {}
27 }; 27 };
28 28
29
30 IN_PROC_BROWSER_TEST_F(RenderViewHostTest, 29 IN_PROC_BROWSER_TEST_F(RenderViewHostTest,
31 ExecuteJavascriptAndGetValue) { 30 ExecuteJavascriptAndGetValue) {
32 ASSERT_TRUE(test_server()->Start()); 31 ASSERT_TRUE(test_server()->Start());
33 GURL empty_url(test_server()->GetURL("files/empty.html")); 32 GURL empty_url(test_server()->GetURL("files/simple_page.html"));
34 ui_test_utils::NavigateToURL(browser(), empty_url); 33 NavigateToURL(shell(), empty_url);
35 34
36 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( 35 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>(
37 chrome::GetActiveWebContents(browser())->GetRenderViewHost()); 36 shell()->web_contents()->GetRenderViewHost());
38 37
39 { 38 {
40 scoped_ptr<Value> value( 39 scoped_ptr<Value> value(
41 rvh->ExecuteJavascriptAndGetValue(string16(), ASCIIToUTF16("!false;"))); 40 rvh->ExecuteJavascriptAndGetValue(string16(), ASCIIToUTF16("!false;")));
42 EXPECT_EQ(Value::TYPE_BOOLEAN, value->GetType()); 41 EXPECT_EQ(Value::TYPE_BOOLEAN, value->GetType());
43 bool bool_value; 42 bool bool_value;
44 EXPECT_TRUE(value->GetAsBoolean(&bool_value)); 43 EXPECT_TRUE(value->GetAsBoolean(&bool_value));
45 EXPECT_TRUE(bool_value); 44 EXPECT_TRUE(bool_value);
46 } 45 }
47 46
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 private: 198 private:
200 net::HostPortPair observed_socket_address_; 199 net::HostPortPair observed_socket_address_;
201 GURL base_url_; 200 GURL base_url_;
202 int navigation_count_; 201 int navigation_count_;
203 202
204 DISALLOW_COPY_AND_ASSIGN(RenderViewHostTestWebContentsObserver); 203 DISALLOW_COPY_AND_ASSIGN(RenderViewHostTestWebContentsObserver);
205 }; 204 };
206 205
207 IN_PROC_BROWSER_TEST_F(RenderViewHostTest, FrameNavigateSocketAddress) { 206 IN_PROC_BROWSER_TEST_F(RenderViewHostTest, FrameNavigateSocketAddress) {
208 ASSERT_TRUE(test_server()->Start()); 207 ASSERT_TRUE(test_server()->Start());
209 RenderViewHostTestWebContentsObserver observer( 208 RenderViewHostTestWebContentsObserver observer(shell()->web_contents());
210 chrome::GetActiveWebContents(browser()));
211 209
212 GURL test_url = test_server()->GetURL("files/simple.html"); 210 GURL test_url = test_server()->GetURL("files/simple_page.html");
213 ui_test_utils::NavigateToURL(browser(), test_url); 211 NavigateToURL(shell(), test_url);
214 212
215 EXPECT_EQ(test_server()->host_port_pair().ToString(), 213 EXPECT_EQ(test_server()->host_port_pair().ToString(),
216 observer.observed_socket_address().ToString()); 214 observer.observed_socket_address().ToString());
217 EXPECT_EQ(1, observer.navigation_count()); 215 EXPECT_EQ(1, observer.navigation_count());
218 } 216 }
219 217
220 IN_PROC_BROWSER_TEST_F(RenderViewHostTest, BaseURLParam) { 218 IN_PROC_BROWSER_TEST_F(RenderViewHostTest, BaseURLParam) {
221 ASSERT_TRUE(test_server()->Start()); 219 ASSERT_TRUE(test_server()->Start());
222 RenderViewHostTestWebContentsObserver observer( 220 RenderViewHostTestWebContentsObserver observer(shell()->web_contents());
223 chrome::GetActiveWebContents(browser()));
224 221
225 // Base URL is not set if it is the same as the URL. 222 // Base URL is not set if it is the same as the URL.
226 GURL test_url = test_server()->GetURL("files/simple.html"); 223 GURL test_url = test_server()->GetURL("files/simple_page.tml");
227 ui_test_utils::NavigateToURL(browser(), test_url); 224 NavigateToURL(shell(), test_url);
228 EXPECT_TRUE(observer.base_url().is_empty()); 225 EXPECT_TRUE(observer.base_url().is_empty());
229 EXPECT_EQ(1, observer.navigation_count()); 226 EXPECT_EQ(1, observer.navigation_count());
230 227
231 // But should be set to the original page when reading MHTML. 228 // But should be set to the original page when reading MHTML.
232 test_url = net::FilePathToFileURL(test_server()->document_root().Append( 229 test_url = net::FilePathToFileURL(test_server()->document_root().Append(
233 FILE_PATH_LITERAL("google.mht"))); 230 FILE_PATH_LITERAL("google.mht")));
234 ui_test_utils::NavigateToURL(browser(), test_url); 231 NavigateToURL(shell(), test_url);
235 EXPECT_EQ("http://www.google.com/", observer.base_url().spec()); 232 EXPECT_EQ("http://www.google.com/", observer.base_url().spec());
236 } 233 }
234
235 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/plugin_service_impl_browsertest.cc ('k') | content/browser/webkit_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698