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

Side by Side Diff: content/browser/dom_storage/dom_storage_browsertest.cc

Issue 10702029: Move tab functions off Browser into browser_tabstrip and browser_tabrestore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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/path_service.h" 5 #include "base/path_service.h"
6 #include "chrome/browser/ui/browser.h" 6 #include "chrome/browser/ui/browser.h"
7 #include "chrome/browser/ui/browser_tabstrip.h"
7 #include "chrome/test/base/in_process_browser_test.h" 8 #include "chrome/test/base/in_process_browser_test.h"
8 #include "chrome/test/base/ui_test_utils.h" 9 #include "chrome/test/base/ui_test_utils.h"
9 #include "content/browser/web_contents/web_contents_impl.h" 10 #include "content/browser/web_contents/web_contents_impl.h"
10 #include "content/public/common/content_paths.h" 11 #include "content/public/common/content_paths.h"
11 #include "net/base/net_util.h" 12 #include "net/base/net_util.h"
12 #include "webkit/dom_storage/dom_storage_types.h" 13 #include "webkit/dom_storage/dom_storage_types.h"
13 14
14 // This browser test is aimed towards exercising the DomStorage system 15 // This browser test is aimed towards exercising the DomStorage system
15 // from end-to-end. 16 // from end-to-end.
16 class DomStorageBrowserTest : public InProcessBrowserTest { 17 class DomStorageBrowserTest : public InProcessBrowserTest {
17 public: 18 public:
18 DomStorageBrowserTest() { 19 DomStorageBrowserTest() {
19 EnableDOMAutomation(); 20 EnableDOMAutomation();
20 } 21 }
21 22
22 GURL GetTestURL(const char* name) { 23 GURL GetTestURL(const char* name) {
23 FilePath file_name = FilePath().AppendASCII(name); 24 FilePath file_name = FilePath().AppendASCII(name);
24 FilePath dir; 25 FilePath dir;
25 PathService::Get(content::DIR_TEST_DATA, &dir); 26 PathService::Get(content::DIR_TEST_DATA, &dir);
26 return net::FilePathToFileURL( 27 return net::FilePathToFileURL(
27 dir.Append(FILE_PATH_LITERAL("dom_storage")).Append(file_name)); 28 dir.Append(FILE_PATH_LITERAL("dom_storage")).Append(file_name));
28 } 29 }
29 30
30 void SimpleTest(const GURL& test_url, bool incognito) { 31 void SimpleTest(const GURL& test_url, bool incognito) {
31 // The test page will perform tests then navigate to either 32 // The test page will perform tests then navigate to either
32 // a #pass or #fail ref. 33 // a #pass or #fail ref.
33 Browser* the_browser = incognito ? CreateIncognitoBrowser() : browser(); 34 Browser* the_browser = incognito ? CreateIncognitoBrowser() : browser();
34 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( 35 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(
35 the_browser, test_url, 2); 36 the_browser, test_url, 2);
36 std::string result = the_browser->GetActiveWebContents()->GetURL().ref(); 37 std::string result =
38 chrome::GetActiveWebContents(the_browser)->GetURL().ref();
37 if (result != "pass") { 39 if (result != "pass") {
38 std::string js_result; 40 std::string js_result;
39 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( 41 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString(
40 the_browser->GetActiveWebContents()->GetRenderViewHost(), L"", 42 chrome::GetActiveWebContents(the_browser)->GetRenderViewHost(), L"",
41 L"window.domAutomationController.send(getLog())", &js_result)); 43 L"window.domAutomationController.send(getLog())", &js_result));
42 FAIL() << "Failed: " << js_result; 44 FAIL() << "Failed: " << js_result;
43 } 45 }
44 } 46 }
45 }; 47 };
46 48
47 static const bool kIncognito = true; 49 static const bool kIncognito = true;
48 static const bool kNotIncognito = false; 50 static const bool kNotIncognito = false;
49 51
50 IN_PROC_BROWSER_TEST_F(DomStorageBrowserTest, SanityCheck) { 52 IN_PROC_BROWSER_TEST_F(DomStorageBrowserTest, SanityCheck) {
51 SimpleTest(GetTestURL("sanity_check.html"), kNotIncognito); 53 SimpleTest(GetTestURL("sanity_check.html"), kNotIncognito);
52 } 54 }
53 55
54 IN_PROC_BROWSER_TEST_F(DomStorageBrowserTest, SanityCheckIncognito) { 56 IN_PROC_BROWSER_TEST_F(DomStorageBrowserTest, SanityCheckIncognito) {
55 SimpleTest(GetTestURL("sanity_check.html"), kIncognito); 57 SimpleTest(GetTestURL("sanity_check.html"), kIncognito);
56 } 58 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698