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

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

Issue 2649963002: Enable mojo localstorage to actually store on disk. (Closed)
Patch Set: Remove Sync() method, and instead make sure browser test waits long enough. Created 3 years, 10 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/command_line.h" 5 #include "base/command_line.h"
6 #include "content/browser/dom_storage/dom_storage_context_wrapper.h"
7 #include "content/browser/dom_storage/local_storage_context_mojo.h"
6 #include "content/browser/web_contents/web_contents_impl.h" 8 #include "content/browser/web_contents/web_contents_impl.h"
7 #include "content/common/dom_storage/dom_storage_types.h" 9 #include "content/common/dom_storage/dom_storage_types.h"
10 #include "content/public/browser/browser_context.h"
11 #include "content/public/browser/storage_partition.h"
8 #include "content/public/common/content_paths.h" 12 #include "content/public/common/content_paths.h"
9 #include "content/public/common/content_switches.h" 13 #include "content/public/common/content_switches.h"
10 #include "content/public/test/browser_test_utils.h" 14 #include "content/public/test/browser_test_utils.h"
11 #include "content/public/test/content_browser_test.h" 15 #include "content/public/test/content_browser_test.h"
12 #include "content/public/test/content_browser_test_utils.h" 16 #include "content/public/test/content_browser_test_utils.h"
13 #include "content/shell/browser/shell.h" 17 #include "content/shell/browser/shell.h"
14 18
15 namespace content { 19 namespace content {
16 20
17 // This browser test is aimed towards exercising the DOMStorage system 21 // This browser test is aimed towards exercising the DOMStorage system
(...skipping 18 matching lines...) Expand all
36 } 40 }
37 } 41 }
38 }; 42 };
39 43
40 class MojoDOMStorageBrowserTest : public DOMStorageBrowserTest { 44 class MojoDOMStorageBrowserTest : public DOMStorageBrowserTest {
41 public: 45 public:
42 void SetUpCommandLine(base::CommandLine* command_line) override { 46 void SetUpCommandLine(base::CommandLine* command_line) override {
43 ContentBrowserTest::SetUpCommandLine(command_line); 47 ContentBrowserTest::SetUpCommandLine(command_line);
44 command_line->AppendSwitch(switches::kMojoLocalStorage); 48 command_line->AppendSwitch(switches::kMojoLocalStorage);
45 } 49 }
50
51 void Flush() {
52 // First make sure a connection to the database was set up.
53 LocalStorageContextMojo* context =
54 static_cast<DOMStorageContextWrapper*>(
55 BrowserContext::GetDefaultStoragePartition(
56 shell()->web_contents()->GetBrowserContext())
57 ->GetDOMStorageContext())
58 ->mojo_state_.get();
59 base::RunLoop run_loop;
60 context->RunWhenConnected(run_loop.QuitClosure());
61 run_loop.Run();
62 // Then process any tasks that are currently queued, to ensure
63 // LevelDBWrapperImpl methods get called.
64 base::RunLoop().RunUntilIdle();
65 // And finally flush all the now queued up changes to leveldb.
66 context->Flush();
67 }
46 }; 68 };
47 69
48 static const bool kIncognito = true; 70 static const bool kIncognito = true;
49 static const bool kNotIncognito = false; 71 static const bool kNotIncognito = false;
50 72
51 IN_PROC_BROWSER_TEST_F(DOMStorageBrowserTest, SanityCheck) { 73 IN_PROC_BROWSER_TEST_F(DOMStorageBrowserTest, SanityCheck) {
52 SimpleTest(GetTestUrl("dom_storage", "sanity_check.html"), kNotIncognito); 74 SimpleTest(GetTestUrl("dom_storage", "sanity_check.html"), kNotIncognito);
53 } 75 }
54 76
55 IN_PROC_BROWSER_TEST_F(DOMStorageBrowserTest, SanityCheckIncognito) { 77 IN_PROC_BROWSER_TEST_F(DOMStorageBrowserTest, SanityCheckIncognito) {
56 SimpleTest(GetTestUrl("dom_storage", "sanity_check.html"), kIncognito); 78 SimpleTest(GetTestUrl("dom_storage", "sanity_check.html"), kIncognito);
57 } 79 }
58 80
81 IN_PROC_BROWSER_TEST_F(DOMStorageBrowserTest, PRE_DataPersists) {
82 SimpleTest(GetTestUrl("dom_storage", "store_data.html"), kNotIncognito);
83 }
84
85 // http://crbug.com/654704 PRE_ tests aren't supported on Android.
86 #if defined(OS_ANDROID)
87 #define MAYBE_DataPersists DISABLED_DataPersists
88 #else
89 #define MAYBE_DataPersists DataPersists
90 #endif
91 IN_PROC_BROWSER_TEST_F(DOMStorageBrowserTest, MAYBE_DataPersists) {
92 SimpleTest(GetTestUrl("dom_storage", "verify_data.html"), kNotIncognito);
93 }
94
59 IN_PROC_BROWSER_TEST_F(MojoDOMStorageBrowserTest, SanityCheck) { 95 IN_PROC_BROWSER_TEST_F(MojoDOMStorageBrowserTest, SanityCheck) {
60 SimpleTest(GetTestUrl("dom_storage", "sanity_check.html"), kNotIncognito); 96 SimpleTest(GetTestUrl("dom_storage", "sanity_check.html"), kNotIncognito);
61 } 97 }
62 98
63 IN_PROC_BROWSER_TEST_F(MojoDOMStorageBrowserTest, SanityCheckIncognito) { 99 IN_PROC_BROWSER_TEST_F(MojoDOMStorageBrowserTest, SanityCheckIncognito) {
64 SimpleTest(GetTestUrl("dom_storage", "sanity_check.html"), kIncognito); 100 SimpleTest(GetTestUrl("dom_storage", "sanity_check.html"), kIncognito);
65 } 101 }
66 102
103 IN_PROC_BROWSER_TEST_F(MojoDOMStorageBrowserTest, PRE_DataPersists) {
104 SimpleTest(GetTestUrl("dom_storage", "store_data.html"), kNotIncognito);
105 Flush();
106 }
107
108 IN_PROC_BROWSER_TEST_F(MojoDOMStorageBrowserTest, MAYBE_DataPersists) {
109 SimpleTest(GetTestUrl("dom_storage", "verify_data.html"), kNotIncognito);
110 }
111
67 } // namespace content 112 } // namespace content
OLDNEW
« no previous file with comments | « components/leveldb/leveldb_mojo_proxy.cc ('k') | content/browser/dom_storage/dom_storage_context_wrapper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698