OLD | NEW |
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/string_util.h" | 5 #include "base/string_util.h" |
6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
7 #include "chrome/browser/ui/browser.h" | 7 #include "chrome/browser/ui/browser.h" |
8 #include "chrome/browser/ui/browser_commands.h" | 8 #include "chrome/browser/ui/browser_commands.h" |
9 #include "chrome/browser/ui/browser_tabstrip.h" | 9 #include "chrome/browser/ui/browser_tabstrip.h" |
10 #include "chrome/test/base/in_process_browser_test.h" | 10 #include "chrome/test/base/in_process_browser_test.h" |
11 #include "chrome/test/base/ui_test_utils.h" | 11 #include "chrome/test/base/ui_test_utils.h" |
12 #include "content/public/browser/notification_service.h" | 12 #include "content/public/browser/notification_service.h" |
13 #include "content/public/browser/notification_types.h" | 13 #include "content/public/browser/notification_types.h" |
14 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
15 #include "content/public/common/url_constants.h" | 15 #include "content/public/common/url_constants.h" |
16 #include "net/test/test_server.h" | 16 #include "net/test/test_server.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
18 | 18 |
19 class SessionHistoryTest : public InProcessBrowserTest { | 19 class SessionHistoryTest : public InProcessBrowserTest { |
20 protected: | 20 protected: |
21 SessionHistoryTest() { | 21 SessionHistoryTest() {} |
22 EnableDOMAutomation(); | |
23 } | |
24 | 22 |
25 virtual void SetUpOnMainThread() { | 23 virtual void SetUpOnMainThread() { |
26 ASSERT_TRUE(test_server()->Start()); | 24 ASSERT_TRUE(test_server()->Start()); |
27 } | 25 } |
28 | 26 |
29 // Simulate clicking a link. Only works on the frames.html testserver page. | 27 // Simulate clicking a link. Only works on the frames.html testserver page. |
30 void ClickLink(std::string node_id) { | 28 void ClickLink(std::string node_id) { |
31 GURL url("javascript:clickLink('" + node_id + "')"); | 29 GURL url("javascript:clickLink('" + node_id + "')"); |
32 ui_test_utils::NavigateToURL(browser(), url); | 30 ui_test_utils::NavigateToURL(browser(), url); |
33 } | 31 } |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 GoBack(); | 457 GoBack(); |
460 | 458 |
461 // Ensure history.length is properly truncated. | 459 // Ensure history.length is properly truncated. |
462 ui_test_utils::NavigateToURL(browser(), GetURL("title2.html")); | 460 ui_test_utils::NavigateToURL(browser(), GetURL("title2.html")); |
463 | 461 |
464 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractInt( | 462 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractInt( |
465 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), | 463 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), |
466 L"", L"domAutomationController.send(history.length)", &length)); | 464 L"", L"domAutomationController.send(history.length)", &length)); |
467 EXPECT_EQ(2, length); | 465 EXPECT_EQ(2, length); |
468 } | 466 } |
OLD | NEW |