void run() {
        // Squelch logging.
        Log::setObserver(std::make_unique<Log::NullObserver>());

        spriteLoader.setObserver(&observer);
        spriteLoader.load("test/fixtures/resources/sprite", fileSource);

        loop.run();
    }
    void run(const std::string& url, const std::string& fontStack, const std::set<GlyphRange>& glyphRanges) {
        // Squelch logging.
        Log::setObserver(std::make_unique<Log::NullObserver>());

        glyphStore.setObserver(&observer);
        glyphStore.setURL(url);
        glyphStore.hasGlyphRanges(fontStack, glyphRanges);

        loop.run();
    }
    void run(const std::string& url, GlyphDependencies dependencies) {
        // Squelch logging.
        Log::setObserver(std::make_unique<Log::NullObserver>());

        glyphManager.setURL(url);
        glyphManager.setObserver(&observer);
        glyphManager.getGlyphs(requestor, std::move(dependencies));

        loop.run();
    }
示例#4
0
    void run(const std::string& url) {
        // Squelch logging.
        Log::setObserver(std::make_unique<Log::NullObserver>());

        util::ThreadContext::Set(&context);
        util::ThreadContext::setFileSource(&fileSource);

        spriteStore.setObserver(&observer);
        spriteStore.setURL(url);

        loop.run();
    }
示例#5
0
    unsigned numRequests = 1000;

    mbgl::DefaultFileSource* fs;
    std::unique_ptr<mbgl::FileRequest> request;

    std::function<void(mbgl::Response)> requestCallback;
};

}

TEST_F(Storage, AssetStress) {
    SCOPED_TEST(AssetStress)

    using namespace mbgl;

    util::RunLoop loop;

    mbgl::DefaultFileSource fs(nullptr, getFileSourceRoot());

    unsigned numThreads = 50;

    auto callback = [&] {
        if (!--numThreads) {
            loop.stop();
        }
    };

    std::vector<std::unique_ptr<util::Thread<TestWorker>>> threads;
    std::vector<std::unique_ptr<mbgl::WorkRequest>> requests;
    util::ThreadContext context = { "Test", util::ThreadType::Map, util::ThreadPriority::Regular };
 void end() {
     loop.stop();
 }
示例#7
0
 void run() {
     loop.run();
 }