OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/common/chrome_switches.h" | 5 #include "chrome/common/chrome_switches.h" |
6 #include "chrome/test/automation/tab_proxy.h" | 6 #include "chrome/test/automation/tab_proxy.h" |
7 #include "chrome/test/ui/ui_layout_test.h" | 7 #include "chrome/test/ui/ui_layout_test.h" |
8 | 8 |
9 // TODO(jorlow): Enable all of these tests, eventually... | 9 // TODO(jorlow): Enable all of these tests, eventually... |
10 static const char* kEventsFiles[] = { | 10 static const char* kEventsFiles[] = { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 76 |
77 // This is somewhat of a hack because we're running a real browser that | 77 // This is somewhat of a hack because we're running a real browser that |
78 // actually persists the LocalStorage state vs. DRT and TestShell which don't. | 78 // actually persists the LocalStorage state vs. DRT and TestShell which don't. |
79 // The correct fix is to fix the LayoutTests, but similar patches have been | 79 // The correct fix is to fix the LayoutTests, but similar patches have been |
80 // rejected in the past. | 80 // rejected in the past. |
81 void ClearDOMStorage() { | 81 void ClearDOMStorage() { |
82 scoped_refptr<TabProxy> tab(GetActiveTab()); | 82 scoped_refptr<TabProxy> tab(GetActiveTab()); |
83 ASSERT_TRUE(tab.get()); | 83 ASSERT_TRUE(tab.get()); |
84 | 84 |
85 GURL url = GetTestUrl(L"layout_tests", L"clear_dom_storage.html"); | 85 GURL url = GetTestUrl(L"layout_tests", L"clear_dom_storage.html"); |
| 86 tab->SetCookie(url, ""); |
86 ASSERT_TRUE(tab->NavigateToURL(url)); | 87 ASSERT_TRUE(tab->NavigateToURL(url)); |
87 | 88 |
88 WaitUntilCookieNonEmpty(tab.get(), url, "cleared", kTestIntervalMs, | 89 WaitUntilCookieNonEmpty(tab.get(), url, "cleared", kTestIntervalMs, |
89 kTestWaitTimeoutMs); | 90 kTestWaitTimeoutMs); |
90 } | 91 } |
91 | 92 |
92 // Runs each test in an array of strings until it hits a NULL. | 93 // Runs each test in an array of strings until it hits a NULL. |
93 void RunTests(const char** files) { | 94 void RunTests(const char** files) { |
94 while (*files) { | 95 while (*files) { |
95 ClearDOMStorage(); | 96 ClearDOMStorage(); |
96 RunLayoutTest(*files, false); | 97 RunLayoutTest(*files, false); |
97 ++files; | 98 ++files; |
98 } | 99 } |
99 } | 100 } |
100 | 101 |
101 FilePath test_dir_; | 102 FilePath test_dir_; |
102 }; | 103 }; |
103 | 104 |
104 // http://code.google.com/p/chromium/issues/detail?id=24145 | |
105 #if defined(OS_WIN) | |
106 #define MAYBE_DOMStorageLayoutTests FLAKY_DOMStorageLayoutTests | |
107 #define MAYBE_SessionStorageLayoutTests FLAKY_SessionStorageLayoutTests | |
108 #else | |
109 #define MAYBE_DOMStorageLayoutTests DOMStorageLayoutTests | |
110 #define MAYBE_SessionStorageLayoutTests SessionStorageLayoutTests | |
111 #endif // defined(OS_WIN) | |
112 | 105 |
113 | 106 TEST_F(DOMStorageTest, DOMStorageLayoutTests) { |
114 TEST_F(DOMStorageTest, MAYBE_DOMStorageLayoutTests) { | |
115 InitializeForLayoutTest(test_dir_, FilePath(), false); | 107 InitializeForLayoutTest(test_dir_, FilePath(), false); |
116 AddResources(); | 108 AddResources(); |
117 RunTests(kTopLevelFiles); | 109 RunTests(kTopLevelFiles); |
118 } | 110 } |
119 | 111 |
120 | 112 |
121 TEST_F(DOMStorageTest, FLAKY_LocalStorageLayoutTests) { | 113 TEST_F(DOMStorageTest, LocalStorageLayoutTests) { |
122 InitializeForLayoutTest(test_dir_, FilePath().AppendASCII("localstorage"), | 114 InitializeForLayoutTest(test_dir_, FilePath().AppendASCII("localstorage"), |
123 false); | 115 false); |
124 AddResources(); | 116 AddResources(); |
125 RunTests(kNoEventsFiles); | 117 RunTests(kNoEventsFiles); |
126 RunTests(kEventsFiles); | 118 RunTests(kEventsFiles); |
127 RunTests(kLocalStorageFiles); | 119 RunTests(kLocalStorageFiles); |
128 } | 120 } |
129 | 121 |
130 TEST_F(DOMStorageTest, MAYBE_SessionStorageLayoutTests) { | 122 TEST_F(DOMStorageTest, SessionStorageLayoutTests) { |
131 InitializeForLayoutTest(test_dir_, FilePath().AppendASCII("sessionstorage"), | 123 InitializeForLayoutTest(test_dir_, FilePath().AppendASCII("sessionstorage"), |
132 false); | 124 false); |
133 AddResources(); | 125 AddResources(); |
134 RunTests(kNoEventsFiles); | 126 RunTests(kNoEventsFiles); |
135 //RunTests(kEventsFiles); | 127 //RunTests(kEventsFiles); |
136 RunTests(kSessionStorageFiles); | 128 RunTests(kSessionStorageFiles); |
137 } | 129 } |
OLD | NEW |