Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: webkit/glue/dom_operations_unittest.cc

Issue 10959020: SystemMonitor refactoring: move power state monitor into a separate class called PowerMonitor (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: add power notifier Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/file_util.h" 5 #include "base/file_util.h"
6 #include "base/path_service.h" 6 #include "base/path_service.h"
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "net/base/net_util.h" 9 #include "net/base/net_util.h"
10 #include "net/url_request/url_request_context.h" 10 #include "net/url_request/url_request_context.h"
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
12 #include "webkit/glue/dom_operations.h" 12 #include "webkit/glue/dom_operations.h"
13 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" 13 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h"
14 #include "webkit/tools/test_shell/test_shell_test.h" 14 #include "webkit/tools/test_shell/test_shell_test.h"
15 15
16 #if defined(OS_MACOSX)
17 #include "base/power_monitor/power_monitor.h"
18 #endif
19
16 namespace { 20 namespace {
17 21
18 class DomOperationsTests : public TestShellTest { 22 class DomOperationsTests : public TestShellTest {
19 public: 23 public:
24 DomOperationsTests();
20 // Test function GetAllSavableResourceLinksForCurrentPage with a web page. 25 // Test function GetAllSavableResourceLinksForCurrentPage with a web page.
21 // We expect result of GetAllSavableResourceLinksForCurrentPage exactly 26 // We expect result of GetAllSavableResourceLinksForCurrentPage exactly
22 // matches expected_resources_set. 27 // matches expected_resources_set.
23 void GetSavableResourceLinksForPage(const FilePath& page_file_path, 28 void GetSavableResourceLinksForPage(const FilePath& page_file_path,
24 const std::set<GURL>& expected_resources_set); 29 const std::set<GURL>& expected_resources_set);
25 30
26 protected: 31 protected:
27 // testing::Test 32 // testing::Test
28 virtual void SetUp() { 33 virtual void SetUp() {
29 TestShellTest::SetUp(); 34 TestShellTest::SetUp();
30 } 35 }
31 36
32 virtual void TearDown() { 37 virtual void TearDown() {
33 TestShellTest::TearDown(); 38 TestShellTest::TearDown();
34 } 39 }
35 }; 40 };
36 41
42 DomOperationsTests::DomOperationsTests() {
43 #if defined(OS_MACOSX)
44 base::PowerMonitor::AllocateSystemIOPorts();
45 #endif
46 }
37 47
38 void DomOperationsTests::GetSavableResourceLinksForPage( 48 void DomOperationsTests::GetSavableResourceLinksForPage(
39 const FilePath& page_file_path, 49 const FilePath& page_file_path,
40 const std::set<GURL>& expected_resources_set) { 50 const std::set<GURL>& expected_resources_set) {
41 // Convert local file path to file URL. 51 // Convert local file path to file URL.
42 GURL file_url = net::FilePathToFileURL(page_file_path); 52 GURL file_url = net::FilePathToFileURL(page_file_path);
43 // Load the test file. 53 // Load the test file.
44 test_shell_->ResetTestController(); 54 test_shell_->ResetTestController();
45 test_shell_->LoadURL(file_url); 55 test_shell_->LoadURL(file_url);
46 test_shell_->WaitTestFinished(); 56 test_shell_->WaitTestFinished();
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 page_file_path.AppendASCII(expected_frame_links[i]); 134 page_file_path.AppendASCII(expected_frame_links[i]);
125 expected_resources_set.insert( 135 expected_resources_set.insert(
126 net::FilePathToFileURL(expected_frame_url)); 136 net::FilePathToFileURL(expected_frame_url));
127 } 137 }
128 138
129 page_file_path = page_file_path.AppendASCII("youtube_2.htm"); 139 page_file_path = page_file_path.AppendASCII("youtube_2.htm");
130 GetSavableResourceLinksForPage(page_file_path, expected_resources_set); 140 GetSavableResourceLinksForPage(page_file_path, expected_resources_set);
131 } 141 }
132 142
133 } // namespace 143 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698