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

Side by Side Diff: chrome/browser/browsing_data/browsing_data_remover_browsertest.cc

Issue 11753009: Simplify ExecuteJavaScript* functions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update prerender_browsertest.cc. Created 7 years, 11 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 | Annotate | Revision Log
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_path.h" 5 #include "base/file_path.h"
6 #include "base/path_service.h" 6 #include "base/path_service.h"
7 #include "chrome/browser/browsing_data/browsing_data_helper.h" 7 #include "chrome/browser/browsing_data/browsing_data_helper.h"
8 #include "chrome/browser/browsing_data/browsing_data_remover.h" 8 #include "chrome/browser/browsing_data/browsing_data_remover.h"
9 #include "chrome/browser/prefs/pref_service.h" 9 #include "chrome/browser/prefs/pref_service.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 28 matching lines...) Expand all
39 virtual void SetUpOnMainThread() OVERRIDE { 39 virtual void SetUpOnMainThread() OVERRIDE {
40 FilePath path; 40 FilePath path;
41 PathService::Get(content::DIR_TEST_DATA, &path); 41 PathService::Get(content::DIR_TEST_DATA, &path);
42 BrowserThread::PostTask( 42 BrowserThread::PostTask(
43 BrowserThread::IO, FROM_HERE, base::Bind(&SetUrlRequestMock, path)); 43 BrowserThread::IO, FROM_HERE, base::Bind(&SetUrlRequestMock, path));
44 } 44 }
45 45
46 void RunScriptAndCheckResult(const std::string& script, 46 void RunScriptAndCheckResult(const std::string& script,
47 const std::string& result) { 47 const std::string& result) {
48 std::string data; 48 std::string data;
49 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractString( 49 ASSERT_TRUE(content::ExecuteScriptAndExtractString(
50 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), 50 chrome::GetActiveWebContents(browser()), script, &data));
51 "",
52 script,
53 &data));
54 ASSERT_EQ(data, result); 51 ASSERT_EQ(data, result);
55 } 52 }
56 53
57 void RemoveAndWait(int remove_mask) { 54 void RemoveAndWait(int remove_mask) {
58 content::WindowedNotificationObserver signal( 55 content::WindowedNotificationObserver signal(
59 chrome::NOTIFICATION_BROWSING_DATA_REMOVED, 56 chrome::NOTIFICATION_BROWSING_DATA_REMOVED,
60 content::Source<Profile>(browser()->profile())); 57 content::Source<Profile>(browser()->profile()));
61 BrowsingDataRemover* remover = BrowsingDataRemover::CreateForPeriod( 58 BrowsingDataRemover* remover = BrowsingDataRemover::CreateForPeriod(
62 browser()->profile(), BrowsingDataRemover::LAST_HOUR); 59 browser()->profile(), BrowsingDataRemover::LAST_HOUR);
63 remover->Remove(remove_mask, BrowsingDataHelper::UNPROTECTED_WEB); 60 remover->Remove(remove_mask, BrowsingDataHelper::UNPROTECTED_WEB);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 ui_test_utils::NavigateToURL(browser(), url); 109 ui_test_utils::NavigateToURL(browser(), url);
113 RunScriptAndCheckResult("createTable()", "done"); 110 RunScriptAndCheckResult("createTable()", "done");
114 RunScriptAndCheckResult("insertRecord('text2')", "done"); 111 RunScriptAndCheckResult("insertRecord('text2')", "done");
115 RunScriptAndCheckResult("getRecords()", "text2"); 112 RunScriptAndCheckResult("getRecords()", "text2");
116 } 113 }
117 114
118 // Profile::ClearNetworkingHistorySince should be exercised here too see whether 115 // Profile::ClearNetworkingHistorySince should be exercised here too see whether
119 // the call gets delegated through ProfileIO[Impl]Data properly, which is hard 116 // the call gets delegated through ProfileIO[Impl]Data properly, which is hard
120 // to write unit-tests for. Currently this is done by both of the above tests. 117 // to write unit-tests for. Currently this is done by both of the above tests.
121 // Add standalone test if this changes. 118 // Add standalone test if this changes.
OLDNEW
« no previous file with comments | « chrome/browser/browser_keyevents_browsertest.cc ('k') | chrome/browser/chrome_switches_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698