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

Side by Side Diff: chrome/browser/extensions/api/media_galleries_private/media_galleries_private_apitest.cc

Issue 120303003: [StorageMonitor] Move gallery name generation to StorageInfo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address vandebo's comments Created 6 years, 9 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/strings/stringprintf.h" 5 #include "base/strings/stringprintf.h"
6 #include "base/strings/utf_string_conversions.h" 6 #include "base/strings/utf_string_conversions.h"
7 #include "chrome/browser/extensions/api/media_galleries_private/media_galleries_ private_api.h" 7 #include "chrome/browser/extensions/api/media_galleries_private/media_galleries_ private_api.h"
8 #include "chrome/browser/extensions/extension_apitest.h" 8 #include "chrome/browser/extensions/extension_apitest.h"
9 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/extensions/extension_test_message_listener.h" 10 #include "chrome/browser/extensions/extension_test_message_listener.h"
11 #include "chrome/browser/ui/browser.h" 11 #include "chrome/browser/ui/browser.h"
12 #include "chrome/common/chrome_switches.h" 12 #include "chrome/common/chrome_switches.h"
13 #include "chrome/test/base/ui_test_utils.h" 13 #include "chrome/test/base/ui_test_utils.h"
14 #include "components/storage_monitor/storage_info.h" 14 #include "components/storage_monitor/storage_info.h"
15 #include "components/storage_monitor/storage_monitor.h" 15 #include "components/storage_monitor/storage_monitor.h"
16 #include "components/storage_monitor/test_storage_monitor.h" 16 #include "components/storage_monitor/test_storage_monitor.h"
17 #include "content/public/browser/render_view_host.h" 17 #include "content/public/browser/render_view_host.h"
18 #include "content/public/browser/web_contents.h" 18 #include "content/public/browser/web_contents.h"
19 #include "content/public/test/browser_test_utils.h" 19 #include "content/public/test/browser_test_utils.h"
20 #include "extensions/browser/extension_system.h" 20 #include "extensions/browser/extension_system.h"
21 #include "extensions/common/extension.h" 21 #include "extensions/common/extension.h"
22 #include "url/gurl.h"
23 22
24 using storage_monitor::StorageInfo; 23 using storage_monitor::StorageInfo;
25 using storage_monitor::StorageMonitor; 24 using storage_monitor::StorageMonitor;
26 using storage_monitor::TestStorageMonitor; 25 using storage_monitor::TestStorageMonitor;
27 26
28 namespace { 27 namespace {
29 28
30 // Id of test extension from 29 // Id of test extension from
31 // chrome/test/data/extensions/api_test/|kTestExtensionPath| 30 // chrome/test/data/extensions/api_test/|kTestExtensionPath|
32 const char kTestExtensionId[] = "lkegdcleigedmkiikoijjgfchobofdbe"; 31 const char kTestExtensionId[] = "lkegdcleigedmkiikoijjgfchobofdbe";
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 EXPECT_TRUE(listener.WaitUntilSatisfied()); 85 EXPECT_TRUE(listener.WaitUntilSatisfied());
87 } 86 }
88 87
89 void AttachDetach() { 88 void AttachDetach() {
90 Attach(); 89 Attach();
91 Detach(); 90 Detach();
92 } 91 }
93 92
94 void Attach() { 93 void Attach() {
95 DCHECK(StorageMonitor::GetInstance()->IsInitialized()); 94 DCHECK(StorageMonitor::GetInstance()->IsInitialized());
96 StorageInfo info(device_id_, base::ASCIIToUTF16(kDeviceName), kDevicePath, 95 const StorageInfo info(device_id_, kDevicePath,
97 base::string16(), base::string16(), base::string16(), 0); 96 base::ASCIIToUTF16(kDeviceName), base::string16(),
97 base::string16(), 0);
98 StorageMonitor::GetInstance()->receiver()->ProcessAttach(info); 98 StorageMonitor::GetInstance()->receiver()->ProcessAttach(info);
99 content::RunAllPendingInMessageLoop(); 99 content::RunAllPendingInMessageLoop();
100 } 100 }
101 101
102 void Detach() { 102 void Detach() {
103 DCHECK(StorageMonitor::GetInstance()->IsInitialized()); 103 DCHECK(StorageMonitor::GetInstance()->IsInitialized());
104 StorageMonitor::GetInstance()->receiver()->ProcessDetach(device_id_); 104 StorageMonitor::GetInstance()->receiver()->ProcessDetach(device_id_);
105 content::RunAllPendingInMessageLoop(); 105 content::RunAllPendingInMessageLoop();
106 } 106 }
107 107
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 Attach(); 188 Attach();
189 EXPECT_TRUE(attach_finished_listener.WaitUntilSatisfied()); 189 EXPECT_TRUE(attach_finished_listener.WaitUntilSatisfied());
190 Detach(); 190 Detach();
191 EXPECT_TRUE(detach_finished_listener.WaitUntilSatisfied()); 191 EXPECT_TRUE(detach_finished_listener.WaitUntilSatisfied());
192 192
193 Attach(); 193 Attach();
194 EXPECT_TRUE(attach_finished_listener.WaitUntilSatisfied()); 194 EXPECT_TRUE(attach_finished_listener.WaitUntilSatisfied());
195 Detach(); 195 Detach();
196 EXPECT_TRUE(detach_finished_listener.WaitUntilSatisfied()); 196 EXPECT_TRUE(detach_finished_listener.WaitUntilSatisfied());
197 } 197 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698