yoav | a1a508b4 | 2015-10-20 12:03:21 | [diff] [blame] | 1 | // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include <stdlib.h> |
| 6 | |
| 7 | #include "content/public/test/browser_test_utils.h" |
| 8 | #include "content/public/test/content_browser_test.h" |
| 9 | #include "content/public/test/content_browser_test_utils.h" |
| 10 | #include "content/public/test/test_navigation_observer.h" |
| 11 | #include "content/shell/browser/shell.h" |
| 12 | |
| 13 | namespace content { |
| 14 | |
| 15 | class ResourceLoadingBrowserTest : public ContentBrowserTest { |
| 16 | }; |
| 17 | |
| 18 | const char kResourceLoadingNonMobilePage[] = |
svaldez | 799d159 | 2015-12-03 21:10:08 | [diff] [blame] | 19 | "/resource_loading/resource_loading_non_mobile.html"; |
yoav | e746b156 | 2015-10-27 12:19:29 | [diff] [blame] | 20 | |
yoav | a1a508b4 | 2015-10-20 12:03:21 | [diff] [blame] | 21 | IN_PROC_BROWSER_TEST_F(ResourceLoadingBrowserTest, |
| 22 | ResourceLoadingAvoidDoubleDownloads) { |
svaldez | 799d159 | 2015-12-03 21:10:08 | [diff] [blame] | 23 | ASSERT_TRUE(embedded_test_server()->Start()); |
| 24 | GURL url = embedded_test_server()->GetURL(kResourceLoadingNonMobilePage); |
yoav | a1a508b4 | 2015-10-20 12:03:21 | [diff] [blame] | 25 | NavigateToURL(shell(), url); |
| 26 | int data = -1; |
| 27 | EXPECT_TRUE(ExecuteScriptAndExtractInt(shell()->web_contents(), |
| 28 | "getResourceNumber()", &data)); |
yoav | e746b156 | 2015-10-27 12:19:29 | [diff] [blame] | 29 | EXPECT_EQ(2, data); |
yoav | a1a508b4 | 2015-10-20 12:03:21 | [diff] [blame] | 30 | } |
| 31 | |
| 32 | } // namespace content |