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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 // ip address, net error code, and expiration time in days from now | 114 // ip address, net error code, and expiration time in days from now |
115 // as parameters. If the error code indicates failure, the ip address | 115 // as parameters. If the error code indicates failure, the ip address |
116 // must be an empty string. | 116 // must be an empty string. |
117 void AddCacheEntry(const ListValue* list_value); | 117 void AddCacheEntry(const ListValue* list_value); |
118 | 118 |
119 // Navigates to the prerender in the background tab. This assumes that | 119 // Navigates to the prerender in the background tab. This assumes that |
120 // there is a "Click()" function in the background tab which will navigate | 120 // there is a "Click()" function in the background tab which will navigate |
121 // there, and that the background tab exists at slot 1. | 121 // there, and that the background tab exists at slot 1. |
122 void NavigateToPrerender(const ListValue* list_value); | 122 void NavigateToPrerender(const ListValue* list_value); |
123 | 123 |
124 // Creates an incognito browser. | 124 // Creates an incognito browser. Once creation is complete, passes a |
| 125 // message to the Javascript test harness. |
125 void CreateIncognitoBrowser(const ListValue* list_value); | 126 void CreateIncognitoBrowser(const ListValue* list_value); |
126 | 127 |
127 // Closes an incognito browser created with CreateIncognitoBrowser. | 128 // Closes an incognito browser created with CreateIncognitoBrowser. |
128 void CloseIncognitoBrowser(const ListValue* list_value); | 129 void CloseIncognitoBrowser(const ListValue* list_value); |
129 | 130 |
130 Browser* browser() { | 131 Browser* browser() { |
131 return net_internals_test_->browser(); | 132 return net_internals_test_->browser(); |
132 } | 133 } |
133 | 134 |
134 NetInternalsTest* net_internals_test_; | 135 NetInternalsTest* net_internals_test_; |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 void NetInternalsTest::MessageHandler::NavigateToPrerender( | 258 void NetInternalsTest::MessageHandler::NavigateToPrerender( |
258 const ListValue* list_value) { | 259 const ListValue* list_value) { |
259 RenderViewHost* host = browser()->GetTabContentsAt(1)->render_view_host(); | 260 RenderViewHost* host = browser()->GetTabContentsAt(1)->render_view_host(); |
260 host->ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16("Click()")); | 261 host->ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16("Click()")); |
261 } | 262 } |
262 | 263 |
263 void NetInternalsTest::MessageHandler::CreateIncognitoBrowser( | 264 void NetInternalsTest::MessageHandler::CreateIncognitoBrowser( |
264 const ListValue* list_value) { | 265 const ListValue* list_value) { |
265 ASSERT_FALSE(incognito_browser_); | 266 ASSERT_FALSE(incognito_browser_); |
266 incognito_browser_ = net_internals_test_->CreateIncognitoBrowser(); | 267 incognito_browser_ = net_internals_test_->CreateIncognitoBrowser(); |
| 268 |
| 269 // Tell the test harness that creation is complete. |
| 270 StringValue command_value("onIncognitoBrowserCreatedForTest"); |
| 271 web_ui()->CallJavascriptFunction("g_browser.receive", command_value); |
267 } | 272 } |
268 | 273 |
269 void NetInternalsTest::MessageHandler::CloseIncognitoBrowser( | 274 void NetInternalsTest::MessageHandler::CloseIncognitoBrowser( |
270 const ListValue* list_value) { | 275 const ListValue* list_value) { |
271 ASSERT_TRUE(incognito_browser_); | 276 ASSERT_TRUE(incognito_browser_); |
272 incognito_browser_->CloseAllTabs(); | 277 incognito_browser_->CloseAllTabs(); |
273 // Closing all a Browser's tabs will ultimately result in its destruction, | 278 // Closing all a Browser's tabs will ultimately result in its destruction, |
274 // thought it may not have been destroyed yet. | 279 // thought it may not have been destroyed yet. |
275 incognito_browser_ = NULL; | 280 incognito_browser_ = NULL; |
276 } | 281 } |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 } | 401 } |
397 | 402 |
398 // Adds two entries to the DNS cache, clears the cache, and then repeats. | 403 // Adds two entries to the DNS cache, clears the cache, and then repeats. |
399 IN_PROC_BROWSER_TEST_F(NetInternalsTest, NetInternalsDnsViewAddTwoTwice) { | 404 IN_PROC_BROWSER_TEST_F(NetInternalsTest, NetInternalsDnsViewAddTwoTwice) { |
400 EXPECT_TRUE(RunJavascriptAsyncTest("netInternalsDnsViewAddTwoTwice")); | 405 EXPECT_TRUE(RunJavascriptAsyncTest("netInternalsDnsViewAddTwoTwice")); |
401 } | 406 } |
402 | 407 |
403 // Makes sure that openning and then closing an incognito window clears the | 408 // Makes sure that openning and then closing an incognito window clears the |
404 // DNS cache. To keep things simple, we add a fake cache entry ourselves, | 409 // DNS cache. To keep things simple, we add a fake cache entry ourselves, |
405 // rather than having the incognito browser create one. | 410 // rather than having the incognito browser create one. |
406 #if defined(OS_CHROMEOS) | |
407 // http://crbug.com/106707 | |
408 #define NetInternalsDnsViewIncognitoClears \ | |
409 FLAKY_NetInternalsDnsViewIncognitoClears | |
410 #endif | |
411 IN_PROC_BROWSER_TEST_F(NetInternalsTest, NetInternalsDnsViewIncognitoClears) { | 411 IN_PROC_BROWSER_TEST_F(NetInternalsTest, NetInternalsDnsViewIncognitoClears) { |
412 EXPECT_TRUE(RunJavascriptAsyncTest("netInternalsDnsViewIncognitoClears")); | 412 EXPECT_TRUE(RunJavascriptAsyncTest("netInternalsDnsViewIncognitoClears")); |
413 } | 413 } |
414 | 414 |
415 //////////////////////////////////////////////////////////////////////////////// | 415 //////////////////////////////////////////////////////////////////////////////// |
416 // test_view.js | 416 // test_view.js |
417 //////////////////////////////////////////////////////////////////////////////// | 417 //////////////////////////////////////////////////////////////////////////////// |
418 | 418 |
419 // Runs the test suite twice, expecting a passing result the first time. Checks | 419 // Runs the test suite twice, expecting a passing result the first time. Checks |
420 // the first result, the order of events that occur, and the number of rows in | 420 // the first result, the order of events that occur, and the number of rows in |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 // log_view_painter.js | 536 // log_view_painter.js |
537 //////////////////////////////////////////////////////////////////////////////// | 537 //////////////////////////////////////////////////////////////////////////////// |
538 | 538 |
539 // Check that we correctly remove cookies and login information. | 539 // Check that we correctly remove cookies and login information. |
540 IN_PROC_BROWSER_TEST_F(NetInternalsTest, | 540 IN_PROC_BROWSER_TEST_F(NetInternalsTest, |
541 NetInternalsLogViewPainterStripInfo) { | 541 NetInternalsLogViewPainterStripInfo) { |
542 EXPECT_TRUE(RunJavascriptAsyncTest("netInternalsLogViewPainterStripInfo")); | 542 EXPECT_TRUE(RunJavascriptAsyncTest("netInternalsLogViewPainterStripInfo")); |
543 } | 543 } |
544 | 544 |
545 } // namespace | 545 } // namespace |
OLD | NEW |