OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/file_path.h" | 5 #include "base/file_path.h" |
6 #include "base/platform_thread.h" | 6 #include "base/platform_thread.h" |
7 #include "chrome/test/automation/browser_proxy.h" | 7 #include "chrome/test/automation/browser_proxy.h" |
8 #include "chrome/test/automation/tab_proxy.h" | 8 #include "chrome/test/automation/tab_proxy.h" |
9 #include "chrome/test/ui/ui_test.h" | 9 #include "chrome/test/ui/ui_test.h" |
10 #include "net/base/net_util.h" | 10 #include "net/base/net_util.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 // The title of the active tab should change each time this URL is loaded. | 22 // The title of the active tab should change each time this URL is loaded. |
23 GURL url( | 23 GURL url( |
24 "data:text/html,<script>document.title=new Date().valueOf()</script>"); | 24 "data:text/html,<script>document.title=new Date().valueOf()</script>"); |
25 | 25 |
26 NavigateToURL(url); | 26 NavigateToURL(url); |
27 | 27 |
28 std::wstring title1 = GetActiveTabTitle(); | 28 std::wstring title1 = GetActiveTabTitle(); |
29 | 29 |
30 scoped_refptr<TabProxy> tab(GetActiveTab()); | 30 scoped_refptr<TabProxy> tab(GetActiveTab()); |
| 31 ASSERT_TRUE(tab.get()); |
31 | 32 |
32 // Cause the renderer to crash. | 33 // Cause the renderer to crash. |
33 // TODO: Need to port crash_service.exe. | 34 // TODO: Need to port crash_service.exe. |
34 #if defined(OS_WIN) | 35 #if defined(OS_WIN) |
35 expected_crashes_ = 1; | 36 expected_crashes_ = 1; |
36 #endif | 37 #endif |
37 tab->NavigateToURLAsync(GURL("about:crash")); | 38 tab->NavigateToURLAsync(GURL("about:crash")); |
38 | 39 |
39 // Wait for the browser to notice the renderer crash. | 40 // Wait for the browser to notice the renderer crash. |
40 PlatformThread::Sleep(1000); | 41 PlatformThread::Sleep(1000); |
(...skipping 17 matching lines...) Expand all Loading... |
58 FilePath test_file(test_data_directory_); | 59 FilePath test_file(test_data_directory_); |
59 test_file = test_file.AppendASCII("title2.html"); | 60 test_file = test_file.AppendASCII("title2.html"); |
60 GURL url(net::FilePathToFileURL(test_file)); | 61 GURL url(net::FilePathToFileURL(test_file)); |
61 | 62 |
62 NavigateToURL(url); | 63 NavigateToURL(url); |
63 | 64 |
64 const std::wstring title(L"Title Of Awesomeness"); | 65 const std::wstring title(L"Title Of Awesomeness"); |
65 EXPECT_EQ(title, GetActiveTabTitle()); | 66 EXPECT_EQ(title, GetActiveTabTitle()); |
66 | 67 |
67 scoped_refptr<TabProxy> tab(GetActiveTab()); | 68 scoped_refptr<TabProxy> tab(GetActiveTab()); |
| 69 ASSERT_TRUE(tab.get()); |
68 | 70 |
69 // Cause the renderer to crash. | 71 // Cause the renderer to crash. |
70 // TODO: Need to port crash_service.exe. | 72 // TODO: Need to port crash_service.exe. |
71 #if defined(OS_WIN) | 73 #if defined(OS_WIN) |
72 expected_crashes_ = 1; | 74 expected_crashes_ = 1; |
73 #endif | 75 #endif |
74 | 76 |
75 tab->NavigateToURLAsync(GURL("about:crash")); | 77 tab->NavigateToURLAsync(GURL("about:crash")); |
76 | 78 |
77 // Wait for the browser to notice the renderer crash. | 79 // Wait for the browser to notice the renderer crash. |
78 PlatformThread::Sleep(1000); | 80 PlatformThread::Sleep(1000); |
79 | 81 |
80 scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); | 82 scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); |
81 ASSERT_TRUE(browser_proxy->AppendTab(url)); | 83 ASSERT_TRUE(browser_proxy->AppendTab(url)); |
82 | 84 |
83 // Ensure the title of the new tab is updated, indicating that the navigation | 85 // Ensure the title of the new tab is updated, indicating that the navigation |
84 // entry was properly committed. | 86 // entry was properly committed. |
85 EXPECT_EQ(title, GetActiveTabTitle()); | 87 EXPECT_EQ(title, GetActiveTabTitle()); |
86 } | 88 } |
OLD | NEW |