| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/test/base/in_process_browser_test.h" | 9 #include "chrome/test/base/in_process_browser_test.h" |
| 10 #include "chrome/test/base/ui_test_utils.h" | 10 #include "chrome/test/base/ui_test_utils.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 RenderViewHostTest() {} | 24 RenderViewHostTest() {} |
| 25 }; | 25 }; |
| 26 | 26 |
| 27 | 27 |
| 28 IN_PROC_BROWSER_TEST_F(RenderViewHostTest, | 28 IN_PROC_BROWSER_TEST_F(RenderViewHostTest, |
| 29 ExecuteJavascriptAndGetValue) { | 29 ExecuteJavascriptAndGetValue) { |
| 30 ASSERT_TRUE(test_server()->Start()); | 30 ASSERT_TRUE(test_server()->Start()); |
| 31 GURL empty_url(test_server()->GetURL("files/empty.html")); | 31 GURL empty_url(test_server()->GetURL("files/empty.html")); |
| 32 ui_test_utils::NavigateToURL(browser(), empty_url); | 32 ui_test_utils::NavigateToURL(browser(), empty_url); |
| 33 | 33 |
| 34 RenderViewHost* rvh = | 34 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( |
| 35 browser()->GetSelectedWebContents()->GetRenderViewHost(); | 35 browser()->GetSelectedWebContents()->GetRenderViewHost()); |
| 36 | 36 |
| 37 { | 37 { |
| 38 Value* value = rvh->ExecuteJavascriptAndGetValue(string16(), | 38 Value* value = rvh->ExecuteJavascriptAndGetValue(string16(), |
| 39 ASCIIToUTF16("!false;")); | 39 ASCIIToUTF16("!false;")); |
| 40 EXPECT_EQ(Value::TYPE_BOOLEAN, value->GetType()); | 40 EXPECT_EQ(Value::TYPE_BOOLEAN, value->GetType()); |
| 41 bool bool_value; | 41 bool bool_value; |
| 42 EXPECT_TRUE(value->GetAsBoolean(&bool_value)); | 42 EXPECT_TRUE(value->GetAsBoolean(&bool_value)); |
| 43 EXPECT_TRUE(bool_value); | 43 EXPECT_TRUE(bool_value); |
| 44 } | 44 } |
| 45 | 45 |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 ui_test_utils::NavigateToURL(browser(), test_url); | 220 ui_test_utils::NavigateToURL(browser(), test_url); |
| 221 EXPECT_TRUE(observer.base_url().is_empty()); | 221 EXPECT_TRUE(observer.base_url().is_empty()); |
| 222 EXPECT_EQ(1, observer.navigation_count()); | 222 EXPECT_EQ(1, observer.navigation_count()); |
| 223 | 223 |
| 224 // But should be set to the original page when reading MHTML. | 224 // But should be set to the original page when reading MHTML. |
| 225 test_url = net::FilePathToFileURL(test_server()->document_root().Append( | 225 test_url = net::FilePathToFileURL(test_server()->document_root().Append( |
| 226 FILE_PATH_LITERAL("google.mht"))); | 226 FILE_PATH_LITERAL("google.mht"))); |
| 227 ui_test_utils::NavigateToURL(browser(), test_url); | 227 ui_test_utils::NavigateToURL(browser(), test_url); |
| 228 EXPECT_EQ("http://www.google.com/", observer.base_url().spec()); | 228 EXPECT_EQ("http://www.google.com/", observer.base_url().spec()); |
| 229 } | 229 } |
| OLD | NEW |